68 /// \bug Is this a good name for this? Or "reverse" is better? |
68 /// \bug Is this a good name for this? Or "reverse" is better? |
69 Edge opposite(const Edge &e) const { |
69 Edge opposite(const Edge &e) const { |
70 return Edge(e,!e.forward); |
70 return Edge(e,!e.forward); |
71 } |
71 } |
72 |
72 |
73 /// Tail of the given Edge. |
73 /// Source of the given Edge. |
74 Node tail(const Edge &e) const { |
74 Node source(const Edge &e) const { |
75 return e.forward ? Parent::tail(e) : Parent::head(e); |
75 return e.forward ? Parent::source(e) : Parent::target(e); |
76 } |
76 } |
77 |
77 |
78 /// \todo Shouldn't the "tail" of an undirected edge be called "aNode" |
78 /// \todo Shouldn't the "source" of an undirected edge be called "aNode" |
79 /// or something??? |
79 /// or something??? |
80 using Parent::tail; |
80 using Parent::source; |
81 |
81 |
82 /// Head of the given Edge. |
82 /// Target of the given Edge. |
83 Node head(const Edge &e) const { |
83 Node target(const Edge &e) const { |
84 return e.forward ? Parent::head(e) : Parent::tail(e); |
84 return e.forward ? Parent::target(e) : Parent::source(e); |
85 } |
85 } |
86 |
86 |
87 /// \todo Shouldn't the "head" of an undirected edge be called "bNode" |
87 /// \todo Shouldn't the "target" of an undirected edge be called "bNode" |
88 /// or something??? |
88 /// or something??? |
89 using Parent::head; |
89 using Parent::target; |
90 |
90 |
91 /// Returns whether the given directed edge is same orientation as the |
91 /// Returns whether the given directed edge is same orientation as the |
92 /// corresponding undirected edge. |
92 /// corresponding undirected edge. |
93 /// |
93 /// |
94 /// \todo reference to the corresponding point of the undirected graph |
94 /// \todo reference to the corresponding point of the undirected graph |
95 /// concept. "What does the direction of an undirected edge mean?" |
95 /// concept. "What does the direction of an undirected edge mean?" |
96 bool forward(const Edge &e) const { return e.forward; } |
96 bool forward(const Edge &e) const { return e.forward; } |
97 |
97 |
98 Node oppsiteNode(const Node &n, const Edge &e) const { |
98 Node oppsiteNode(const Node &n, const Edge &e) const { |
99 if( n == Parent::tail(e)) |
99 if( n == Parent::source(e)) |
100 return Parent::head(e); |
100 return Parent::target(e); |
101 else if( n == Parent::head(e)) |
101 else if( n == Parent::target(e)) |
102 return Parent::tail(e); |
102 return Parent::source(e); |
103 else |
103 else |
104 return INVALID; |
104 return INVALID; |
105 } |
105 } |
106 |
106 |
107 |
107 |