N
- the class of the nodesE
- the class of the edgespublic class ReportingGraph<N,E>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<E>[][] |
edges |
protected java.util.ArrayList<N> |
nodes |
Constructor and Description |
---|
ReportingGraph() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(N node1,
N node2,
E edge)
Connect 2 nodes with the given edge
|
int |
addNode(N node) |
boolean |
existsDirectEdge(N n1,
N n2)
check if 2 Nodes are connected by 1 (and only one) edge
|
java.util.ArrayList<E> |
getEdges(N node)
get all Edges connected with the given node
|
java.util.List<E> |
getEdges(N n1,
N n2)
get All Edges connecting the start and end node directly
|
N |
getEndNode(N startNode,
E edge)
return the endnode of an egde
|
N |
getNodeWithMostEdges()
returns the node with the most edges connected, can be used as center of the graph
|
N |
getNodeWithMostEdges(java.util.List<N> oneOfThisnodes)
returns the node with the most edges connected, can be used as center of the graph
|
int |
size() |
protected java.util.ArrayList<N> nodes
protected java.util.ArrayList<E>[][] edges
public int size()
public int addNode(N node)
public void addEdge(N node1, N node2, E edge)
node1
- node2
- edge
- public java.util.ArrayList<E> getEdges(N node)
node
- public boolean existsDirectEdge(N n1, N n2)
n1
- startnoden2
- endnodepublic java.util.List<E> getEdges(N n1, N n2)
n1
- start noden2
- end notepublic N getNodeWithMostEdges(java.util.List<N> oneOfThisnodes)
nodes
- only nodes in this list will be handled and returned.public N getNodeWithMostEdges()
@enterprise 9.0.33982 Copyright © 2001-2023 Groiss Informatics GmbH. All Rights Reserved.