Graph.GraphType
Constructor and Description |
---|
DirectedGraph(HashSet<T> nodes,
com.google.common.collect.ImmutableSetMultimap<T,T> adj,
com.google.common.collect.ImmutableSetMultimap<T,T> pred,
HashMap<Tuple<T,T>,Double> wts) |
Modifier and Type | Method and Description |
---|---|
int |
degree(T n)
Gets the degree of a node
|
Collection<Map.Entry<T,T>> |
edges()
Gets a collection of the edges
|
Iterator<Map.Entry<T,T>> |
edgesIter()
Iterates over the edges
|
boolean |
hasEdge(T u,
T v)
Returns true if an edge exists in the graph
|
boolean |
hasNode(T n)
Returns true if the graph contains the node n
|
int |
inDegree(T n)
Gets the number of nodes with an edge coming into the query node
|
Collection<T> |
neighbors(T n)
Gets the successors of the node n
|
Collection<T> |
nodes()
Gets a list of nodes in the graph
|
Iterator<T> |
nodesIter()
Gets an iterator over the nodes
|
int |
numberOfNodes()
Gets the number of nodes in the graph
|
int |
outDegree(T n)
Gets the number of nodes hit by an edge coming out of the query node
|
Collection<T> |
predecessors(T n)
Gets the predecessors of the node n
|
int |
size()
Gets the number of edges in the graph
|
double |
size(boolean weighted)
Gets the sum of edges in the graph
|
Collection<T> |
successors(T n)
Gets the successors of the node n
|
public Iterator<T> nodesIter()
Graph
public Collection<T> nodes()
Graph
public int numberOfNodes()
Graph
numberOfNodes
in interface Graph<T>
public boolean hasNode(T n)
Graph
public boolean hasEdge(T u, T v)
Graph
public Collection<T> neighbors(T n)
public Collection<T> successors(T n)
n
- A nodepublic Collection<T> predecessors(T n)
n
- A nodepublic Collection<Map.Entry<T,T>> edges()
Graph
public Iterator<Map.Entry<T,T>> edgesIter()
Graph
public int inDegree(T n)
n
- The query nodepublic int outDegree(T n)
n
- The query nodepublic int size()
Graph
Copyright © 2018. All rights reserved.