本文整理了Java中org.jgrapht.Graph.outDegreeOf()
方法的一些代码示例,展示了Graph.outDegreeOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.outDegreeOf()
方法的具体详情如下:
包路径:org.jgrapht.Graph
类名称:Graph
方法名:outDegreeOf
[英]Returns the "out degree" of the specified vertex.
The "out degree" of a vertex in a directed graph is the number of outward directed edges from that vertex. See http://mathworld.wolfram.com/Outdegree.html.
In the case of undirected graphs this method returns the number of edges touching the vertex. Edges with same source and target vertices (self-loops) are counted twice.
[中]返回指定顶点的“向外度”。
有向图中一个顶点的“向外度”是该顶点向外的有向边的数目。见http://mathworld.wolfram.com/Outdegree.html。
对于无向图,此方法返回接触顶点的边数。具有相同源顶点和目标顶点(自循环)的边将计数两次。
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@inheritDoc}
*/
@Override
public int outDegreeOf(V vertex)
{
return delegate.outDegreeOf(vertex);
}
代码示例来源:origin: cwensel/cascading
public int outDegreeOf( FlowElement vertex )
{
return graph.outDegreeOf( vertex );
}
代码示例来源:origin: Galigator/openllet
public void destructiveTopologocialSort(final List<ATermAppl> nodesSorted)
{
final Queue<ATermAppl> nodesPending = createQueue();
for (final ATermAppl node : _graph.vertexSet())
if (_graph.outDegreeOf(node) == 0)
nodesPending.add(node);
while (!nodesPending.isEmpty())
{
final ATermAppl node = nodesPending.remove();
assert _graph.outDegreeOf(node) == 0;
nodesSorted.addAll(getAllEquivalents(node));
for (final DefaultEdge edge : _graph.incomingEdgesOf(node))
{
final ATermAppl source = _graph.getEdgeSource(edge);
if (_graph.outDegreeOf(source) == 1)
nodesPending.add(source);
}
_graph.removeVertex(node);
}
assert _graph.vertexSet().isEmpty() : "Failed to sort elements: " + _graph.vertexSet();
}
}
代码示例来源:origin: Galigator/openllet
public void destructiveTopologocialSort(final List<ATermAppl> nodesSorted)
{
final Queue<ATermAppl> nodesPending = createQueue();
for (final ATermAppl node : _graph.vertexSet())
if (_graph.outDegreeOf(node) == 0)
nodesPending.add(node);
while (!nodesPending.isEmpty())
{
final ATermAppl node = nodesPending.remove();
assert _graph.outDegreeOf(node) == 0;
nodesSorted.addAll(getAllEquivalents(node));
for (final DefaultEdge edge : _graph.incomingEdgesOf(node))
{
final ATermAppl source = _graph.getEdgeSource(edge);
if (_graph.outDegreeOf(source) == 1)
nodesPending.add(source);
}
_graph.removeVertex(node);
}
assert _graph.vertexSet().isEmpty() : "Failed to sort elements: " + _graph.vertexSet();
}
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* {@inheritDoc}
*/
@Override
public int outDegreeOf(V vertex)
{
if (type.isMixed()) {
int d = 0;
if (g1.containsVertex(vertex)) {
d += g1.outDegreeOf(vertex);
}
if (g2.containsVertex(vertex)) {
d += g2.outDegreeOf(vertex);
}
return d;
} else if (type.isUndirected()) {
return degreeOf(vertex);
} else {
return outgoingEdgesOf(vertex).size();
}
}
代码示例来源:origin: org.jgrapht/jgrapht-core
/**
* Index the graph and create a double-linked list representation suitable for vertex and edge
* removals in constant time. Ignore any vertices with zero degrees.
*
* @param g the graph to index
*/
private void initialize(Graph<V, E> g)
{
this.g = g;
this.isDirected = g.getType().isDirected();
this.verticesHead = null;
this.eulerianHead = null;
this.startVertex = null;
Map<V, VertexNode> vertices = new HashMap<>();
for (V v : g.vertexSet()) {
if (g.outDegreeOf(v) > 0) {
VertexNode n = new VertexNode(null, v, verticesHead);
if (verticesHead != null) {
verticesHead.prev = n;
}
verticesHead = n;
vertices.put(v, n);
}
}
for (E e : g.edgeSet()) {
VertexNode sNode = vertices.get(g.getEdgeSource(e));
VertexNode tNode = vertices.get(g.getEdgeTarget(e));
addEdge(sNode, tNode, e);
}
}
代码示例来源:origin: org.jgrapht/jgrapht-core
Set<V> postImbalancedVertices = new HashSet<>();
for (V v : graph.vertexSet()) {
int imbalance = graph.outDegreeOf(v) - graph.inDegreeOf(v);
代码示例来源:origin: cwensel/cascading
excludeEdges.addAll( full.incomingEdgesOf( v ) );
if( contracted.outDegreeOf( v ) == 0 )
excludeEdges.addAll( full.outgoingEdgesOf( v ) );
代码示例来源:origin: org.jgrapht/jgrapht-core
if (graph.inDegreeOf(v) != graph.outDegreeOf(v)) {
return false;
if (graph.inDegreeOf(v) > 0 || graph.outDegreeOf(v) > 0) {
if (foundComponentWithEdges) {
return false;
内容来源于网络,如有侵权,请联系作者删除!