# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.graph

## Interface Graph<V,E extends HyperEdge<V>>

• ### Method Summary

All Methods
Modifier and Type Method and Description
Graph<V,E> addEdge(E e)
Adds an edge to this graph.
Graph<V,E> addVertex(V v)
Adds a vertex to this graph.
Set<E> edges()
Gets the set of all edges in this graph.
Set<E> edges(V v)
Gets the set of all edges associated with a vertex in this graph.
Graph<V,E> removeEdge(E e)
Removes an edge from this graph.
Graph<V,E> removeVertex(V v)
Removes a vertex from this graph.
Set<V> vertices()
Gets the set of all vertices in this graph.
• ### Method Detail

• #### vertices

Set<V> vertices()
Gets the set of all vertices in this graph.
Returns:
all vertices in this graph
• #### edges

Set<E> edges()
Gets the set of all edges in this graph.
Returns:
all edges in this graph
• #### edges

Set<E> edges(V v)
Gets the set of all edges associated with a vertex in this graph.
Parameters:
v - a vertex
Returns:
all edges associated with a vertex

Graph<V,E> addVertex(V v)
Adds a vertex to this graph. Does nothing if v is already in the graph.
Parameters:
v - the vertex to add
Returns:
this graph (for builder pattern)

Graph<V,E> addEdge(E e)
Adds an edge to this graph. Does nothing if e is already in the graph. If the edge contains new vertices, those will be added to the graph.
Parameters:
e - the edge to add
Returns:
this graph (for builder pattern)
• #### removeVertex

Graph<V,E> removeVertex(V v)
Removes a vertex from this graph. Does nothing if v is not in the graph. The edges associated with this vertex are also removed.
Parameters:
v - the vertex to be removed
Returns:
this graph (for builder pattern)
• #### removeEdge

Graph<V,E> removeEdge(E e)
Removes an edge from this graph. Does nothing if e is not in the graph. The vertices associated with the edge is not removed.
Parameters:
e - the edge to be removed
Returns:
this graph (for builder pattern)