microsoft / microsoft/automatic-graph-layout

[Help wanted] How to properly add new Edge to GViewer programmatically

Open
#321 0 comments 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

Hello! Please, tell me how to create and add new Egde to GViewer programmatically?
I can't get this working without some hacks at the moment(

new_edge = gcnew Edge(ivn1->Node, ivn2->Node, ConnectionToGraph::Connected, gv->LayoutEditor->EdgeAttr->Clone());
			new_edge->SourcePort = gcnew FloatingPort(new_edge->SourceNode->GeometryNode->BoundaryCurve, new_edge->SourceNode->GeometryNode->Center); // exception SourcePort is null in RouteEdge() without this
			new_edge->TargetPort = gcnew FloatingPort(new_edge->TargetNode->GeometryNode->BoundaryCurve, new_edge->TargetNode->GeometryNode->Center); // exception TargetPort is null in RouteEdge() without this
			IViewerEdge^ ive = gv->RouteEdge(new_edge);
			gv->AddEdge(ive, false); // fails without RouteEdge()
			gv->LayoutEditor->AttachLayoutChangeEvent(ive); // edge line is not moved together with nodes without this (why?)
			setLabelForEdge(ive, weight);

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

No file or test is named. Start by tracing the GViewer Edge, RouteEdge, AddEdge, and LayoutEditor APIs shown in the example, then establish the supported sequence for adding an edge and why ports and layout-change handling are required. Done means documenting a working programmatic procedure and the relevant behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
data-visualization
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.