Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vectors, neighbor and incident lookups
- Loading branch information
1 parent
7c09ddc
commit 5a182a6
Showing
7 changed files
with
157 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,7 +1,21 @@ | |||
module Steffi | module Steffi | ||
class Vertex | class Vertex | ||
def initialize graph | def initialize graph, id | ||
@graph = graph | @graph, @id = graph, id | ||
end | |||
|
|||
def neighbors | |||
mode = 3 # IGRAPH_ALL / FIXME: define and use enum | |||
v = Vector.null | |||
Igraph.neighbors @graph.pointer, v.pointer, @id, mode | |||
v.to_a | |||
end | |||
|
|||
def incident | |||
mode = 3 # IGRAPH_ALL / FIXME: define and use enum | |||
v = Vector.null | |||
Igraph.incident @graph.pointer, v.pointer, @id, mode | |||
v.map &:to_i | |||
end | end | ||
end | end | ||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters