java - How to find the vertices of an edge and if either of those is a leaf node a in JUNG Graph? -


I am working with Jan graph, the problem I am working on can be defined as :

Seeing a corrosion graph G = {V, E} and one edge e1, find nodes / meridians which adds E1 and removes the top if it is a leaf Is the node.

In this way, there are two parts:

  1. Finding edges that are connected to edge edge E1
  2. Find out Is a given headline a leaf node?

    Whether these two campaigns are directly in war, if not, then anyone can recommend an alternative way of getting it.

    (1) graph .getIncidentVertices (E e1)

    (2) What do you mean by "node of pane", but believe that you are in reference to the guided article and a top, an incoming edge and no outward edges, it is easy: Graph. GetIncomingEdges () Size () == 1

    Graph.getOutgoingEdges (). IsEmpty ())

    If the graph is not a multigraph, then you can also: Graph.getPredecessorCount () == 1 < P> Graph.getSuccessorCount () == 0

    Javadoc is very good for rust; You should browse before asking such questions:

Comments