Package es.uam.eps.ir.relison.graph
Interface UndirectedGraph<V>
- Type Parameters:
V
- Type of vertices.
- All Superinterfaces:
Graph<V>
,java.io.Serializable
- All Known Subinterfaces:
UndirectedMultiGraph<V>
,UndirectedUnweightedGraph<V>
,UndirectedUnweightedMultiGraph<V>
,UndirectedWeightedGraph<V>
,UndirectedWeightedMultiGraph<V>
- All Known Implementing Classes:
FastUndirectedUnweightedGraph
,FastUndirectedUnweightedMultiGraph
,FastUndirectedWeightedGraph
,FastUndirectedWeightedMultiGraph
,UndirectedJungGraph
,UndirectedUnweightedComplementaryGraph
,UndirectedWeightedComplementaryGraph
public interface UndirectedGraph<V> extends Graph<V>
Interface for undirected graphs.
-
Method Summary
Modifier and Type Method Description default int
degree(V node)
Calculates the degree of a node.default int
degree(V node, EdgeOrientation orientation)
Obtains the degree of a node, depending on the neighborhood selection.default int
getAdjacentEdgesCount(V node)
Calculates the number of adjacent neighbours of a node.default java.util.stream.Stream<Weight<V,java.lang.Integer>>
getAdjacentMutualNodesTypes(V node)
Given a node, finds the types of the edges towards the nodes u such that the edge (node to u) and the edge (u to node) are in the graph.default java.util.stream.Stream<V>
getAdjacentNodes(V node)
Given a node, finds all the nodes u such that the edge (node to u) is in the graph.default java.util.stream.Stream<Weight<V,java.lang.Integer>>
getAdjacentNodesTypes(V node)
Given a node, finds the types of the edges towards the nodes u such that the edge (node to u) is in the graph.default java.util.stream.Stream<Weight<V,java.lang.Double>>
getAdjacentNodesWeights(V node)
Given a node, finds all the nodes u such that the edge (node to u) is in the graph.default int
getIncidentEdgesCount(V node)
Calculates the number of incident neighbours of a node.default java.util.stream.Stream<Weight<V,java.lang.Integer>>
getIncidentMutualNodesTypes(V node)
Given a node, finds the types of the edges from the nodes u such that the edge (node to u) and the edge (u to node) are in the graph.default java.util.stream.Stream<V>
getIncidentNodes(V node)
Given a node, finds all the nodes u such that the edge (u to node) is in the graph.default java.util.stream.Stream<Weight<V,java.lang.Integer>>
getIncidentNodesTypes(V node)
Given a node, finds the types of the edges from the nodes u such that the edge (u to node) is in the graph.default java.util.stream.Stream<Weight<V,java.lang.Double>>
getIncidentNodesWeights(V node)
Given a node, finds all the nodes u such that the edge (u to node) is in the graph.default int
getMutualEdgesCount(V node)
Calculates the total number of adjacent edges of a node such that there is an incident reciprocal link towards the node.default java.util.stream.Stream<V>
getMutualNodes(V node)
Given a node, finds all the nodes u such that the edges (node to u) and (u to node) are in the graph.default int
getMutualNodesCount(V node)
Calculates the number of nodes for which both (u to node) and (node to u) links exist in the graph.default java.util.stream.Stream<Weight<V,java.lang.Integer>>
getMutualNodesTypes(V node)
Given a node, find the types of edges from the nodes u such that the edge (node to u) and the edge (u to node) are in the graph.default int
getNeighbourEdgesCount(V node)
Calculates the total number of edges which reach a node or start from it (not necessarily equal to the degree).default java.util.stream.Stream<V>
getNeighbourhood(V node, EdgeOrientation direction)
Gets all the nodes in the neighbourhood of a node given by a direction.default int
getNeighbourhoodSize(V node, EdgeOrientation direction)
Gets all the nodes in the neighbourhood of a node given by a direction.default java.util.stream.Stream<Weight<V,java.lang.Integer>>
getNeighbourhoodTypes(V node, EdgeOrientation direction)
Gets all the types of the edges in the neighbourhood of a node given by a direction.default java.util.stream.Stream<Weight<V,java.lang.Double>>
getNeighbourhoodWeights(V node, EdgeOrientation direction)
Gets all the nodes in the neighbourhood of a node given by a direction.default int
inDegree(V node)
Calculates the in-degree of a node.default boolean
isDirected()
Indicates if the graph is directed.default boolean
isMutual(V nodeA, V nodeB)
Checks if an edge in the graph is mutual (a link from A to B and a link from B to A exists).default int
mutualDegree(V node)
Calculates the "mutual" degree of a node, i.e.default int
outDegree(V node)
Calculates the out-degree of a node.Methods inherited from interface es.uam.eps.ir.relison.graph.Graph
addEdge, addEdge, addEdge, addEdge, addEdge, addEdge, addNode, complement, containsEdge, containsVertex, getAdjacencyMatrix, getAdjacencyMatrixMap, getAdjacentMutualNodesWeights, getAdjacentNodesCount, getAllNodes, getEdgeCount, getEdgeType, getEdgeWeight, getIncidentMutualNodesWeights, getIncidentNodesCount, getIsolatedNodes, getMutualNodesWeights, getNeighbourNodes, getNeighbourNodesCount, getNeighbourNodesTypes, getNeighbourNodesWeights, getNodesWithAdjacentNeighbors, getNodesWithIncidentNeighbors, getNodesWithMutualNeighbors, getNodesWithNeighbors, getNodesWithNeighbors, getVertexCount, hasAdjacentNeighbors, hasIncidentNeighbors, hasMutualNeighbors, hasNeighbors, hasNeighbors, isMultigraph, isWeighted, removeEdge, removeNode, updateEdgeType, updateEdgeWeight
-
Method Details
-
getIncidentNodes
Given a node, finds all the nodes u such that the edge (u to node) is in the graph.- Specified by:
getIncidentNodes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream of the incident nodes.
-
getAdjacentNodes
Given a node, finds all the nodes u such that the edge (node to u) is in the graph.- Specified by:
getAdjacentNodes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream containing the adjacent nodes.
-
getMutualNodes
Given a node, finds all the nodes u such that the edges (node to u) and (u to node) are in the graph.- Specified by:
getMutualNodes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream containing all the nodes which share reciprocal links.
-
getNeighbourhood
Gets all the nodes in the neighbourhood of a node given by a direction.- Specified by:
getNeighbourhood
in interfaceGraph<V>
- Parameters:
node
- The node.direction
- The direction of the links.- Returns:
- A stream containing the corresponding neighbourhood.
-
getIncidentEdgesCount
Calculates the number of incident neighbours of a node.- Specified by:
getIncidentEdgesCount
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- the number of incident neighbours of the node if it is contained in the graph, -1 if not.
-
getAdjacentEdgesCount
Calculates the number of adjacent neighbours of a node.- Specified by:
getAdjacentEdgesCount
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- the degree of the node if it is contained in the graph, -1 if not.
-
getMutualEdgesCount
Calculates the total number of adjacent edges of a node such that there is an incident reciprocal link towards the node.- Specified by:
getMutualEdgesCount
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- the number of reciprocal links starting from the node.
-
getNeighbourhoodSize
Gets all the nodes in the neighbourhood of a node given by a direction.- Specified by:
getNeighbourhoodSize
in interfaceGraph<V>
- Parameters:
node
- The node.direction
- The direction of the links.- Returns:
- A stream containing the corresponding neighbourhood.
-
getMutualNodesCount
Calculates the number of nodes for which both (u to node) and (node to u) links exist in the graph.- Specified by:
getMutualNodesCount
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- the number nodes for which both (u to node) and (node to u) exist in the graph if node is in the graph, -1 otherwise.
-
getIncidentNodesWeights
Given a node, finds all the nodes u such that the edge (u to node) is in the graph.- Specified by:
getIncidentNodesWeights
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream of the incident nodes.
-
getAdjacentNodesWeights
Given a node, finds all the nodes u such that the edge (node to u) is in the graph.- Specified by:
getAdjacentNodesWeights
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream containing the adjacent nodes.
-
isMutual
Description copied from interface:Graph
Checks if an edge in the graph is mutual (a link from A to B and a link from B to A exists). -
getNeighbourhoodWeights
default java.util.stream.Stream<Weight<V,java.lang.Double>> getNeighbourhoodWeights(V node, EdgeOrientation direction)Gets all the nodes in the neighbourhood of a node given by a direction.- Specified by:
getNeighbourhoodWeights
in interfaceGraph<V>
- Parameters:
node
- The node.direction
- The direction of the links.- Returns:
- A stream containing the corresponding neighbourhood.
-
degree
Description copied from interface:Graph
Calculates the degree of a node. -
isDirected
default boolean isDirected()Description copied from interface:Graph
Indicates if the graph is directed.- Specified by:
isDirected
in interfaceGraph<V>
- Returns:
- true if it is, false if not.
-
getIncidentNodesTypes
Description copied from interface:Graph
Given a node, finds the types of the edges from the nodes u such that the edge (u to node) is in the graph.- Specified by:
getIncidentNodesTypes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream of the incident nodes and types.
-
getAdjacentNodesTypes
Description copied from interface:Graph
Given a node, finds the types of the edges towards the nodes u such that the edge (node to u) is in the graph.- Specified by:
getAdjacentNodesTypes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream containing the adjacent nodes and types.
-
getMutualNodesTypes
Description copied from interface:Graph
Given a node, find the types of edges from the nodes u such that the edge (node to u) and the edge (u to node) are in the graph.- Specified by:
getMutualNodesTypes
in interfaceGraph<V>
- Parameters:
node
- the node.- Returns:
- a stream containing all the nodes in the neighbourhood and types.
-
getAdjacentMutualNodesTypes
Given a node, finds the types of the edges towards the nodes u such that the edge (node to u) and the edge (u to node) are in the graph.- Specified by:
getAdjacentMutualNodesTypes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream containing all the nodes in the neighbourhood and types.
-
getIncidentMutualNodesTypes
Given a node, finds the types of the edges from the nodes u such that the edge (node to u) and the edge (u to node) are in the graph.- Specified by:
getIncidentMutualNodesTypes
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- A stream containing all the nodes in the neighbourhood and types.
-
getNeighbourhoodTypes
default java.util.stream.Stream<Weight<V,java.lang.Integer>> getNeighbourhoodTypes(V node, EdgeOrientation direction)Description copied from interface:Graph
Gets all the types of the edges in the neighbourhood of a node given by a direction. In the mutual case, it does not work (types are categorical values), so an empty stream is returned.- Specified by:
getNeighbourhoodTypes
in interfaceGraph<V>
- Parameters:
node
- The node.direction
- The direction of the links.- Returns:
- A stream containing the corresponding neighbourhood.
-
getNeighbourEdgesCount
Description copied from interface:Graph
Calculates the total number of edges which reach a node or start from it (not necessarily equal to the degree).- Specified by:
getNeighbourEdgesCount
in interfaceGraph<V>
- Parameters:
node
- The node.- Returns:
- the degree of the node if it is contained in the graph, -1 if not.
-
degree
Description copied from interface:Graph
Obtains the degree of a node, depending on the neighborhood selection. -
inDegree
Description copied from interface:Graph
Calculates the in-degree of a node. -
outDegree
Description copied from interface:Graph
Calculates the out-degree of a node. -
mutualDegree
Description copied from interface:Graph
Calculates the "mutual" degree of a node, i.e. the number of edges between a node and other nodes such that the other nodes are also connected to the original.- Specified by:
mutualDegree
in interfaceGraph<V>
- Parameters:
node
- the node.- Returns:
- the mutual degree of the node if it is contained in the graph, -1 otherwise.
-