Class: LemonGraph::Graph::Arc
- Inherits:
-
LemonGraph::GraphItem
- Object
- LemonGraph::GraphItem
- LemonGraph::Graph::Arc
- Defined in:
- ext/lemongraph/graph_arc.cc,
ext/lemongraph/lemongraph.cc
Overview
Arc of a LemonGraph::Graph, from a source Node to a target Node. Each Edge of a LemonGraph::Graph is composed of two arcs in opposite direction.
Instance Attribute Summary
Attributes inherited from LemonGraph::GraphItem
Instance Method Summary collapse
-
#opposite ⇒ Arc
Returns the arc corresponding to the same edge as self but in the opposite orientation.
-
#source ⇒ Node
Returns the source node of the arc.
-
#target ⇒ Node
Returns the target node of the arc.
-
#valid? ⇒ Boolean
Test if the arc is valid, i.e.
Methods inherited from LemonGraph::GraphItem
Instance Method Details
#opposite ⇒ Arc
Returns the arc corresponding to the same edge as self but in the opposite orientation.
88 89 90 91 92 93 |
# File 'ext/lemongraph/graph_arc.cc', line 88
VALUE lemongraph_unarc_opposite(VALUE self)
{
VALUE g = rb_iv_get(self, "@graph");
lemon::ListGraph::Arc a = lemongraph_graph_rb2ref(g).oppositeArc(lemongraph_rbunarc2unarc(self));
return lemongraph_make_unarc(a, g);
}
|
#source ⇒ Node
Returns the source node of the arc.
66 67 68 69 70 71 |
# File 'ext/lemongraph/graph_arc.cc', line 66
VALUE lemongraph_unarc_source(VALUE self)
{
VALUE g = rb_iv_get(self, "@graph");
lemon::ListGraph::Node n = lemongraph_graph_rb2ref(g).source(lemongraph_rbunarc2unarc(self));
return lemongraph_make_unnode(n, g);
}
|
#target ⇒ Node
Returns the target node of the arc.
77 78 79 80 81 82 |
# File 'ext/lemongraph/graph_arc.cc', line 77
VALUE lemongraph_unarc_target(VALUE self)
{
VALUE g = rb_iv_get(self, "@graph");
lemon::ListGraph::Node n = lemongraph_graph_rb2ref(g).target(lemongraph_rbunarc2unarc(self));
return lemongraph_make_unnode(n, g);
}
|
#valid? ⇒ Boolean
Test if the arc is valid, i.e. it is a real arc of the graph it belons to.
57 58 59 60 |
# File 'ext/lemongraph/graph_arc.cc', line 57
VALUE lemongraph_unarc_is_valid(VALUE self)
{
return lemongraph_graph_rb2ref(rb_iv_get(self, "@graph")).valid(lemongraph_rbunarc2unarc(self)) ? Qtrue : Qfalse;
}
|