networkr 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +10 -0
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile.lock +1 -1
- data/README.md +148 -11
- data/doc/BinaryMinHeap.html +870 -0
- data/doc/Networkr.html +1035 -0
- data/doc/Networkr/DiGraph.html +1013 -0
- data/doc/Networkr/Graph.html +1285 -0
- data/doc/Networkr/MultiGraph.html +532 -0
- data/doc/Networkr/Tracker.html +573 -0
- data/doc/NetworkrError.html +211 -0
- data/doc/_index.html +187 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +481 -0
- data/doc/file.README.html +128 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +128 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +555 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/networkr/algorithms/dijkstra.rb +8 -6
- data/lib/networkr/algorithms/karger.rb +19 -18
- data/lib/networkr/algorithms/kosaraju.rb +52 -38
- data/lib/networkr/algorithms/prim.rb +17 -14
- data/lib/networkr/graphs/digraph.rb +9 -12
- data/lib/networkr/graphs/graph.rb +11 -20
- data/lib/networkr/graphs/multigraph.rb +25 -30
- data/lib/networkr/version.rb +1 -1
- data/lib/utils/heap.rb +1 -1
- data/networkr.gemspec +7 -2
- metadata +37 -5
@@ -1,36 +1,31 @@
|
|
1
|
-
# require_relative "graph.rb"
|
2
|
-
=begin
|
3
|
-
Class for undirected graphs that can store parallel edges.
|
4
|
-
|
5
|
-
A MultiGraph holds undirected edges. Self loops are allowed.
|
6
|
-
|
7
|
-
See Also
|
8
|
-
--------
|
9
|
-
Graph
|
10
|
-
DiGraph
|
11
|
-
=end
|
12
|
-
|
13
1
|
module Networkr
|
14
|
-
class MultiGraph < Graph
|
15
|
-
def new_edge_key(u, v)
|
16
|
-
=begin
|
17
|
-
return an unused key for edges between nodes 'u' and 'v'.
|
18
2
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
u, v: nodes
|
3
|
+
# Class for undirected graphs that can store parallel edges.
|
4
|
+
#
|
5
|
+
# A MultiGraph holds undirected edges. Self loops are allowed.
|
6
|
+
#
|
7
|
+
# See Also
|
8
|
+
# --------
|
9
|
+
# Graph
|
10
|
+
# DiGraph
|
11
|
+
class MultiGraph < Graph
|
29
12
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
13
|
+
# returns an unused key for edges between nodes 'u' and 'v'.
|
14
|
+
#
|
15
|
+
# The nodes 'u' and 'v' do not need to be already in the graph.
|
16
|
+
#
|
17
|
+
# Notes
|
18
|
+
# -----
|
19
|
+
# The new key is the number of existing edges between 'u' and 'v', increased if necessary to ensure uniqueness. The first edge will have key 0, the second edge 1, etc. If an edge is removed, new keys may not be in this order.
|
20
|
+
#
|
21
|
+
# Parameters
|
22
|
+
# ----------
|
23
|
+
# u, v: nodes
|
24
|
+
#
|
25
|
+
# Returns
|
26
|
+
# -------
|
27
|
+
# key: int
|
28
|
+
def new_edge_key(u, v)
|
34
29
|
if @adj[u] && @adj[u][v]
|
35
30
|
keys = @adj[u][v]
|
36
31
|
key = keys.length
|
data/lib/networkr/version.rb
CHANGED
data/lib/utils/heap.rb
CHANGED
data/networkr.gemspec
CHANGED
@@ -9,10 +9,15 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Yi-Ke Peng"]
|
10
10
|
spec.email = ["yi.ke.peng@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.description = %q{
|
12
|
+
spec.summary = %q{Create and manipulate graphs}
|
13
|
+
spec.description = %q{Networkr is a Ruby gem inspired by the Python package NetworkX. It includes basic functionality for the creation, manipulation, and analysis of graphs.
|
14
|
+
|
15
|
+
Graphs supported include undirected single-edge graphs (weighted or unweighted), directed single-edge graphs (weighted or unweighted), and undirected multi-edge graphs (weighted or unweighted).
|
16
|
+
|
17
|
+
Algorithms available include Dijkstra's shortest paths, Karger's minimum cut, Kosaraju's strongly connected components, and Prim's minimum spanning tree.}
|
14
18
|
spec.homepage = "http://github.com/ykpeng/networkr"
|
15
19
|
spec.license = "MIT"
|
20
|
+
spec.metadata["yard.run"] = "yri" # use "yard" to build full HTML docs.
|
16
21
|
|
17
22
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
23
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: networkr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yi-Ke Peng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,7 +52,12 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
-
description:
|
55
|
+
description: |-
|
56
|
+
Networkr is a Ruby gem inspired by the Python package NetworkX. It includes basic functionality for the creation, manipulation, and analysis of graphs.
|
57
|
+
|
58
|
+
Graphs supported include undirected single-edge graphs (weighted or unweighted), directed single-edge graphs (weighted or unweighted), and undirected multi-edge graphs (weighted or unweighted).
|
59
|
+
|
60
|
+
Algorithms available include Dijkstra's shortest paths, Karger's minimum cut, Kosaraju's strongly connected components, and Prim's minimum spanning tree.
|
56
61
|
email:
|
57
62
|
- yi.ke.peng@gmail.com
|
58
63
|
executables: []
|
@@ -60,6 +65,11 @@ extensions: []
|
|
60
65
|
extra_rdoc_files: []
|
61
66
|
files:
|
62
67
|
- ".rspec"
|
68
|
+
- ".yardoc/checksums"
|
69
|
+
- ".yardoc/complete"
|
70
|
+
- ".yardoc/object_types"
|
71
|
+
- ".yardoc/objects/root.dat"
|
72
|
+
- ".yardoc/proxy_types"
|
63
73
|
- Gemfile
|
64
74
|
- Gemfile.lock
|
65
75
|
- LICENSE.txt
|
@@ -67,6 +77,27 @@ files:
|
|
67
77
|
- Rakefile
|
68
78
|
- bin/console
|
69
79
|
- bin/setup
|
80
|
+
- doc/BinaryMinHeap.html
|
81
|
+
- doc/Networkr.html
|
82
|
+
- doc/Networkr/DiGraph.html
|
83
|
+
- doc/Networkr/Graph.html
|
84
|
+
- doc/Networkr/MultiGraph.html
|
85
|
+
- doc/Networkr/Tracker.html
|
86
|
+
- doc/NetworkrError.html
|
87
|
+
- doc/_index.html
|
88
|
+
- doc/class_list.html
|
89
|
+
- doc/css/common.css
|
90
|
+
- doc/css/full_list.css
|
91
|
+
- doc/css/style.css
|
92
|
+
- doc/file.README.html
|
93
|
+
- doc/file_list.html
|
94
|
+
- doc/frames.html
|
95
|
+
- doc/index.html
|
96
|
+
- doc/js/app.js
|
97
|
+
- doc/js/full_list.js
|
98
|
+
- doc/js/jquery.js
|
99
|
+
- doc/method_list.html
|
100
|
+
- doc/top-level-namespace.html
|
70
101
|
- lib/networkr.rb
|
71
102
|
- lib/networkr/algorithms/dijkstra.rb
|
72
103
|
- lib/networkr/algorithms/karger.rb
|
@@ -81,7 +112,8 @@ files:
|
|
81
112
|
homepage: http://github.com/ykpeng/networkr
|
82
113
|
licenses:
|
83
114
|
- MIT
|
84
|
-
metadata:
|
115
|
+
metadata:
|
116
|
+
yard.run: yri
|
85
117
|
post_install_message:
|
86
118
|
rdoc_options: []
|
87
119
|
require_paths:
|
@@ -101,5 +133,5 @@ rubyforge_project:
|
|
101
133
|
rubygems_version: 2.2.2
|
102
134
|
signing_key:
|
103
135
|
specification_version: 4
|
104
|
-
summary:
|
136
|
+
summary: Create and manipulate graphs
|
105
137
|
test_files: []
|