Package | Description |
---|---|
dev.nm.graph | |
dev.nm.graph.algorithm.traversal | |
dev.nm.graph.type |
Modifier and Type | Interface and Description |
---|---|
interface |
DAGraph<V,E extends Arc<V>>
A directed acyclic graph (DAG), is a directed graph with no directed cycles.
|
interface |
DiGraph<V,E extends Arc<V>>
A directed graph or digraph is a graph, or set of nodes connected by edges, where the edges have
a direction associated with them.
|
interface |
Forest<V,E extends HyperEdge<V>>
A forest is a disjoint union of trees.
|
interface |
RootedTree<V,E extends Arc<V>>
A rooted tree is a directed graph, and has a root to measure distance from the
root.
|
interface |
Tree<V,E extends HyperEdge<V>>
A tree is an undirected graph in which any two vertices are connected by exactly one simple path.
|
interface |
UnDiGraph<V,E extends UndirectedEdge<V>>
An undirected graph is a graph, or set of nodes connected by edges, where an edge does not
differentiate between (a, b) or (b, a).
|
Modifier and Type | Method and Description |
---|---|
Graph<V,E> |
Graph.addEdge(E e)
Adds an edge to this graph.
|
Graph<V,E> |
Graph.addVertex(V v)
Adds a vertex to this graph.
|
Graph<V,E> |
Graph.removeEdge(E e)
Removes an edge from this graph.
|
static <V,E extends HyperEdge<V>> |
GraphUtils.removeIsolatedVertices(Graph<V,E> g)
Removes those nodes that have no edges from a graph.
|
Graph<V,E> |
Graph.removeVertex(V v)
Removes a vertex from this graph.
|
Modifier and Type | Method and Description |
---|---|
static <V,E extends HyperEdge<V>> |
GraphUtils.addEdges(Graph<V,E> g,
E... edges)
Add a set of edges to a graph.
|
static <V> void |
GraphUtils.addVertices(Graph<V,?> G,
V... V)
Add a set of vertices to a graph.
|
static <V> boolean |
GraphUtils.containsEdge(Graph<V,?> g,
HyperEdge<V> e)
Returns true if this graph's edge collection contains
e |
static <V> boolean |
GraphUtils.containsVertex(Graph<V,?> g,
V v)
Returns true if this graph's vertex collection contains
v |
static <V> boolean |
GraphUtils.equals(Graph<V,?> g1,
Graph<V,?> g2)
Check if two graphs are equal in terms of node values and edges.
|
static <V> boolean |
GraphUtils.equals(Graph<V,?> g1,
Graph<V,?> g2)
Check if two graphs are equal in terms of node values and edges.
|
static <V> Set<HyperEdge<V>> |
GraphUtils.getEdges(Graph<V,?> g,
V v1,
V v2)
Gets the set of edges that connect the two vertices.
|
static <V> Set<V> |
GraphUtils.getNeighbors(Graph<V,?> g,
V v)
Gets the set of vertices which are connected to
v via any edges in this graph. |
static <V> int |
GraphUtils.numberOfEdges(Graph<V,?> g)
Gets the number of edges in this graph.
|
static <V> int |
GraphUtils.numberOfVertices(Graph<V,?> g)
Gets the number of vertices in this graph.
|
static <V,E extends HyperEdge<V>> |
GraphUtils.removeIsolatedVertices(Graph<V,E> g)
Removes those nodes that have no edges from a graph.
|
Modifier and Type | Field and Description |
---|---|
protected Graph<? extends V,? extends Edge<V>> |
TraversalFromRoots.g |
Modifier and Type | Method and Description |
---|---|
static <V,W extends V> |
BFS.BFS(Graph<W,? extends Edge<V>> g,
V root,
int time)
Runs the breadth-first-search on a graph from a designated root.
|
static <V,W extends V> |
DFS.DFS(Graph<W,? extends Edge<V>> g,
V root,
int time)
Runs the depth-first-search on a graph from a designated root.
|
Constructor and Description |
---|
BFS(Graph<V,? extends Edge<V>> g)
Constructs a BFS tree of a graph.
|
DFS(Graph<? extends V,? extends Edge<V>> g)
Constructs a DFS tree of a graph.
|
TraversalFromRoots(Graph<? extends V,? extends Edge<V>> g)
Constructs a traversal order of a graph.
|
Modifier and Type | Class and Description |
---|---|
class |
SparseDAGraph<V,E extends Arc<V>>
This class implements the sparse directed acyclic graph representation.
|
class |
SparseDiGraph<V,E extends Arc<V>>
This class implements the sparse directed graph representation.
|
class |
SparseGraph<V,E extends HyperEdge<V>>
This class implements the sparse graph representation.
|
class |
SparseTree<V>
This class implements the sparse tree representation.
|
class |
SparseUnDiGraph<V,E extends UndirectedEdge<V>>
This class implements the sparse undirected graph representation.
|
class |
VertexTree<T>
A
VertexTree is both a tree and a vertex/node.This implementation builds a tree
incrementally and recursively (combining trees). |
Constructor and Description |
---|
SparseGraph(Graph<V,E> g)
(Copy) construct a graph from another graph.
|
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.