microsoft / microsoft/automatic-graph-layout

Subgraph nodes horizontally aligned

Open
#80 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.5k
Forks
319
Avg merge
38m
Merged PRs (30d)
1

Description

I'm trying to horizontal align subgraph nodes, without success. Code is:

`
using System.Linq;

graph.AddEdge("A", "B");
graph.AddEdge("A", "C");
graph.AddEdge("A", "D");
Subgraph hello = new Subgraph("hello");
graph.RootSubgraph.AddSubgraph(hello);
hello.AddNode(graph.FindNode("A"));
hello.AddNode(graph.FindNode("B"));
hello.AddNode(graph.FindNode("C"));
hello.AddNode(graph.FindNode("D"));
graph.LayerConstraints.PinNodesToSameLayer(hello.Nodes.ToArray());`

I suspect that by default all nodes of a subgraph belong to the same layer (please correct me if I'm wrong) and that's why my code doesn't work, while SameLayerSample does. But I cannot find a solution to horizontal align subgraph nodes, considering that graph LayerDirection has to beTB (TopBottom).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Subgraph example and compare it with SameLayerSample, focusing on LayerConstraints.PinNodesToSameLayer and the graph's TB LayerDirection. Determine how horizontal alignment of the subgraph nodes is expected to work while preserving top-to-bottom layout, and verify the result with an equivalent graph example.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.