public Graph<T>
Created by Eli Rodgers-Melnick on 7/2/2014 This interface is implemented by graphs, both directed and undirected. The design is inspired by the Python networkx library (https://networkx.github.io/)
java.util.Iterator<T> nodesIter()
Gets an iterator over the nodes
java.util.Collection<T> nodes()
Gets a list of nodes in the graph
int numberOfNodes()
Gets the number of nodes in the graph
boolean hasNode(T n)
Returns true if the graph contains the node n
n - nodeboolean hasEdge(T u,
T v)
Returns true if an edge exists in the graph
u - The first node in the edgev - The second node in the edgejava.util.Collection<T> neighbors(T n)
Gets a collection of the neighbors of a node
n - The node for which you want the neighborsjava.util.Collection<java.util.Map.Entry> edges()
Gets a collection of the edges
java.util.Iterator<java.util.Map.Entry> edgesIter()
Iterates over the edges
int degree(T n)
Gets the degree of a node
n - A node for which you want the degreeint size()
Gets the number of edges in the graph
double size(boolean weighted)
Gets the sum of edges in the graph
weighted - true if weights should be used in the calculation