Package es.uam.eps.ir.relison.graph
Interface DirectedGraph<V>
- Type Parameters:
V
- Type of vertices.
- All Superinterfaces:
Graph<V>
,java.io.Serializable
- All Known Subinterfaces:
DirectedMultiGraph<U>
,DirectedUnweightedGraph<V>
,DirectedUnweightedMultiGraph<V>
,DirectedWeightedGraph<V>
,DirectedWeightedMultiGraph<U>
,Tree<U>
,UnweightedTree<U>
,WeightedTree<U>
- All Known Implementing Classes:
DirectedJungGraph
,DirectedUnweightedComplementaryGraph
,DirectedWeightedComplementaryGraph
,FastDirectedUnweightedGraph
,FastDirectedUnweightedMultiGraph
,FastDirectedWeightedGraph
,FastDirectedWeightedMultiGraph
,FastTree
,FastUnweightedTree
,FastWeightedTree
public interface DirectedGraph<V> extends Graph<V>
Interface for directed 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
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 weights of the edges in the neighbourhood of a node given by a direction.default java.util.stream.Stream<V>
getSinks()
Gets all the nodes which just have incoming links.default java.util.stream.Stream<V>
getSources()
Gets all the nodes which just have outgoing links.default int
inDegree(V node)
Obtains the in-degree of a node.default boolean
isDirected()
Indicates if the graph is directed.default int
mutualDegree(V node)
Obtains the mutual degree of a node.default int
outDegree(V node)
Obtains 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, getAdjacentEdgesCount, getAdjacentMutualNodesTypes, getAdjacentMutualNodesWeights, getAdjacentNodes, getAdjacentNodesCount, getAdjacentNodesTypes, getAdjacentNodesWeights, getAllNodes, getEdgeCount, getEdgeType, getEdgeWeight, getIncidentEdgesCount, getIncidentMutualNodesTypes, getIncidentMutualNodesWeights, getIncidentNodes, getIncidentNodesCount, getIncidentNodesTypes, getIncidentNodesWeights, getIsolatedNodes, getMutualEdgesCount, getMutualNodes, getMutualNodesCount, getMutualNodesTypes, getMutualNodesWeights, getNeighbourNodes, getNeighbourNodesCount, getNeighbourNodesTypes, getNeighbourNodesWeights, getNodesWithAdjacentNeighbors, getNodesWithIncidentNeighbors, getNodesWithMutualNeighbors, getNodesWithNeighbors, getNodesWithNeighbors, getVertexCount, hasAdjacentNeighbors, hasIncidentNeighbors, hasMutualNeighbors, hasNeighbors, hasNeighbors, isMultigraph, isMutual, isWeighted, removeEdge, removeNode, updateEdgeType, updateEdgeWeight
-
Method Details
-
getNeighbourhood
Description copied from interface:Graph
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.
-
getNeighbourhoodSize
Description copied from interface:Graph
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.
-
getNeighbourhoodWeights
default java.util.stream.Stream<Weight<V,java.lang.Double>> getNeighbourhoodWeights(V node, EdgeOrientation direction)Description copied from interface:Graph
Gets all the weights of the edges in the neighbourhood of a node given by a direction. In the mutual case, just returns the average of the edge weights.- Specified by:
getNeighbourhoodWeights
in interfaceGraph<V>
- Parameters:
node
- The node.direction
- The direction of the links- Returns:
- A stream containing the corresponding neighbourhood and weights.
-
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.
-
degree
Description copied from interface:Graph
Calculates the degree of a node. -
inDegree
Obtains the in-degree of a node. -
outDegree
Obtains the out-degree of a node. -
mutualDegree
Obtains the mutual degree of a node.- Specified by:
mutualDegree
in interfaceGraph<V>
- Parameters:
node
- the node.- Returns:
- the mutual degree of the node
-
degree
Description copied from interface:Graph
Obtains the degree of a node, depending on the neighborhood selection. -
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.
-
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.
-
getSources
Gets all the nodes which just have outgoing links.- Returns:
- the set of nodes with just outgoing links.
-
getSinks
Gets all the nodes which just have incoming links.- Returns:
- the set of nodes with just incoming links.
-