3

Version: 1.3.0

Graph Requirement: Child will have many parents or none.

Data Node: Id + List [Parent ids]

class Node {
    String id;
    List<String> parents;
}

Total dataset: 3500 nodes.

GraphType is selected using : Directed + No Multiple Edges + No Self Loops + No Weights + DefaultEdge

Graph Building logic:

  • Iterate through 3500 nodes
  • Create the vertex using node ID.
  • Graph.addVertex(childVertex)
  • then check if parents exists
  • if they do, iterate through parents
  • Create parent id vertex using parent id.
  • Graph.addVertex(parentVertex)
  • Graph.addEdge(parentVertex, childvertex)

However, running the same dataset (3500), for 5 times, I am getting different graph size calculated every time using: graph.vertexSet().size(). Expectation is 3500 everytime but its inconsistent.

All 3500 ids are unique and we should have graph size = 3500 but we got something like: GraphType is - SimpleDirectedGraph and size is variable - 3500, 3208, 3283, 2856, 3284.

Any help would appreciated. Thanks

Amit Gupta
  • 41
  • 2
  • The current question is not suitable for stackoverflow. At the very least, include a minimal working example that exhibits the problem. It is impossible to provide feedback based on the bullet points provided. – Joris Kinable Aug 29 '20 at 05:33

0 Answers0