projects
/
graph.njae.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Initial commit
[graph.njae.git]
/
lib
/
graph
/
edge.rb
1
require
'ostruct'
2
3
module
Graph
4
class
Edge
<
OpenStruct
5
def
initialize
6
super
7
self
.
connections
= []
8
self
9
end
10
11
def
<<(
other
)
12
c
=
Connection
.
new
13
c
.
end
=
other
14
self
.
connections
<<
c
15
self
16
end
17
18
def
vertices
19
self
.
connections
.
map
{|
c
|
c
.
end
}
20
end
21
22
def
connection_at
(
vertex
)
23
self
.
connections
.
select
{|
c
|
c
.
end
.
equal
?
vertex
}.
first
24
end
25
end
26
27
class
Connection
<
OpenStruct
28
def
initialize
29
super
30
self
31
end
32
end
33
end