i need to to some work with Edge object before adding it to graph, so i create it like this
private void AddNewEdgeToGraph(string sourceNodeID, string targetNodeID)
{
Edge newEdge = new Edge(sourceNodeID, "", targetNodeID);
newEdge.LabelText = newEdge.Attr.Weight.ToString();
graph.AddPrecalculatedEdge(newEdge);
}
And, as you have guessed, i get the NullReferenceException on the last line of code. I doubleChecked the parameters for correctness, and i am sure the graph contains nodes with such IDs. I have also tried to add Edges this way:
Edge newEdge = new Edge(graph.FindNode("path1"), graph.FindNode("path2"),
ConnectionToGraph.Connected);
newEdge.LabelText = newEdge.Attr.Weight.ToString();
graph.AddPrecalculatedEdge(newEdge);
And this one works correctly. I thought that the first variant uses the second underneath the hood, so what may be the problem?