microsoft / microsoft/automatic-graph-layout
Graph.Read ignores subgraph in Wpf
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 319
- Avg merge
- 38m
- Merged PRs (30d)
- 1
Description
Hi! I am create a graph add nodes and edges, and put some nodes in a subgraph. Then I am write this graph to *.msagl file and open with Graph.Read from this file and bind it to DockPanel. It display graph with all nodes and edges, but without subgraph.
Code:
GraphViewer graphViewer = new GraphViewer();
Graph graph = new();
graphViewer.BindToPanel(graphViewerPanel);
var a =graph.AddNode("A");
var b = graph.AddNode("B");
var c = graph.AddNode("C");
var d = graph.AddNode("D");
var f = graph.AddNode("F");
b.Attr.Shape = Shape.Hexagon;
var ab = graph.AddEdge(a.Id, b.Id);
var fc = graph.AddEdge(f.Id, c.Id);
var da = graph.AddEdge(d.Id, a.Id);
var fa = graph.AddEdge(a.Id, f.Id);
var s = new Subgraph("sub_Id");
s.Attr.Color = Microsoft.Msagl.Drawing.Color.Red;
s.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Green;
s.Attr.Shape = Shape.Box;
s.Label.FontColor=Microsoft.Msagl.Drawing.Color.Black;
s.Label.Text = "text subgraph";
s.AddNode(a);
s.AddNode(d);
s.AddNode(f);
graph.RootSubgraph.AddSubgraph(s);
graph.Write("test_graph_with_subgraph.msagl");
graph = Graph.Read("test_graph_with_subgraph.msagl");
graphViewer.Graph = graph;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Graph.Write and Graph.Read calls in the supplied reproduction, then inspect how GraphViewer binds the reloaded graph to the WPF DockPanel. Compare the original graph's subgraph membership and attributes with the graph returned by Graph.Read; done means the reloaded graph displays the subgraph with its nodes and styling intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100