networkr 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
- The nodes 'u' and 'v' do not need to be already in the graph.
20
-
21
- Notes
22
- -----
23
-
24
- 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.
25
-
26
- Parameters
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
- Returns
31
- -------
32
- key: int
33
- =end
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
@@ -1,3 +1,3 @@
1
1
  module Networkr
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  class BinaryMinHeap
2
2
  def initialize(&prc)
3
3
  @store = []
4
- @index_map {}
4
+ @index_map = {}
5
5
  @prc = prc || Proc.new { |a, b| a <=> b }
6
6
  end
7
7
 
@@ -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{NetworkR}
13
- spec.description = %q{A gem for creating and manipulating graphs in Ruby.}
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.1
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-24 00:00:00.000000000 Z
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: A gem for creating and manipulating graphs in Ruby.
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: NetworkR
136
+ summary: Create and manipulate graphs
105
137
  test_files: []