Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add graph domain and graph layout to Penrose #332

Closed
wants to merge 12 commits into from
Closed

Conversation

kai-qu
Copy link
Contributor

@kai-qu kai-qu commented Mar 22, 2020

Not ready for review; this PR description will track progress

For the figures in the paper, the original graphviz code and graphviz output can be found here

Programs for this PR can be found here

Other goal diagrams can be found here: #319

Graph layout using a plugin

The plugin is Dagre.

Substance programs

  • one-node.sub
  • two-nodes.sub
  • three-nodes.sub
  • optimization-graph.sub

Command: runpenrose comp-graph-domain/optimization-graph.sub comp-graph-domain/comp-graph-plugin.sty comp-graph-domain/comp-graph.dsl

image

  • computation-graph.sub

Command: runpenrose comp-graph-domain/computation-graph.sub comp-graph-domain/comp-graph-plugin.sty comp-graph-domain/comp-graph.dsl

image

  • dagre-example-graph.sub

image

Known issues

  • Arrow-drawing code doesn't account for arrowhead size
  • Label size is not available to plugin, so we use heuristics
  • Text size cannot be changed
  • Investigate findIntersections code, which doesn't seem to work (maybe it's messing up the label code that calls it?)

Pure Penrose graph layout

(does not use plugin)

Command: runpenrose comp-graph-domain/paper-example-graph.sub comp-graph-domain/comp-graph.sty comp-graph-domain/comp-graph.dsl

(Note: this is NOT graph-theory-domain, which is tracking something else that I don't remember)

Currently goes offscreen


Description

Related issues: #319

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Implementation strategy and design decisions

Include a high-level summary of the implementation strategy and list important design decisions made, if any.

Examples with steps to reproduce them

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • I ran Haddock and there were no errors when generating the HTML site
  • My changes generate no new warnings
  • New and existing tests pass locally using stack test
  • My code follows the style guidelines of this project (e.g.: no HLint warnings)

Open questions

Questions that require more discussion or to be addressed in future development:

@kai-qu
Copy link
Contributor Author

kai-qu commented Apr 2, 2020

Hey @wodeni as requested, I added code in the last commit for calculating intersection between a segment and an axis-aligned bounding box, and drawing a segment between the bboxes. It works, as you can see in the screenshots above.

However, it doesn't yet account for the arrowhead size and how that scales. Since you're the arrowhead czar, can you add that to the code?

@kai-qu
Copy link
Contributor Author

kai-qu commented Apr 3, 2020

actually @wodeni: if you haven't started the arrowhead stuff, I'll write a quick heuristic to deal with it now, so I can tie up loose ends in this PR

@wodeni
Copy link
Member

wodeni commented Apr 3, 2020

actually @wodeni: if you haven't started the arrowhead stuff, I'll write a quick heuristic to deal with it now, so I can tie up loose ends in this PR

The solution will be very similar to the one noted here. The scaling issue is generally unsolved in SVG markers, so the best you can do is some manual offsets like I did with Arrow. For Path it's a bit different, maybe just approximate that by taking the last two points on the polyline to compute the direction of the arrow?

…ying nodes and ops more clearly; match paper
katherineye added 2 commits April 23, 2020 13:25
… is already hard to visualize; need to fiddle with graph layout scale/vertical space constants
Base automatically changed from master to main February 5, 2021 19:18
@wodeni
Copy link
Member

wodeni commented Oct 5, 2021

Closing this PR due to inactivity (also this PR is on the Haskell version).

@wodeni wodeni closed this Oct 5, 2021
@samestep samestep deleted the graph-layout branch March 15, 2023 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants