Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[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.

Assessment

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

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.

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);
Dominant language
C#
Stars
1.5k
Forks
319
PR merge metrics
No merged PRs in 30d

Getting set up

We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.

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.

More from microsoft/automatic-graph-layout

All issues in microsoft/automatic-graph-layout

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.