Class: Rubyvis::Layout::Network::Link
- Defined in:
- lib/rubyvis/layout/network.rb
Overview
Represents a link in a network layout. There is no explicit constructor; this class merely serves to document the attributes that are used on links in network layouts. For hierarchical layouts, this class is used to represent the parent-child links.
Instance Attribute Summary collapse
-
#link_value ⇒ Object
The link value, or weight; optional.
-
#source ⇒ Object
Alias for
sourceNode, as expressed by the index of the source node. -
#source_node ⇒ Object
The link’s source node.
-
#target ⇒ Object
Alias for
targetNode, as expressed by the index of the target node. -
#target_node ⇒ Object
The link’s target node.
-
#value ⇒ Object
Alias for
linkValue.
Instance Method Summary collapse
-
#initialize(opts) ⇒ Link
constructor
A new instance of Link.
Constructor Details
#initialize(opts) ⇒ Link
Returns a new instance of Link.
271 272 273 274 275 |
# File 'lib/rubyvis/layout/network.rb', line 271 def initialize(opts) @source_node=opts.delete :source_node @target_node=opts.delete :target_node @link_value=opts.delete :link_value end |
Instance Attribute Details
#link_value ⇒ Object
The link value, or weight; optional. If not specified (or not a number), the default value of 1 is used.
/
282 283 284 |
# File 'lib/rubyvis/layout/network.rb', line 282 def link_value @link_value end |
#source ⇒ Object
Alias for sourceNode, as expressed by the index of the source node. This attribute is not populated automatically, but may be used as a more convenient identification of the link’s source, for example in a static JSON representation.
303 304 305 |
# File 'lib/rubyvis/layout/network.rb', line 303 def source @source end |
#source_node ⇒ Object
The link’s source node. If not set, this value will be derived from the source attribute index.
289 290 291 |
# File 'lib/rubyvis/layout/network.rb', line 289 def source_node @source_node end |
#target ⇒ Object
Alias for targetNode, as expressed by the index of the target node. This attribute is not populated automatically, but may be used as a more convenient identification of the link’s target, for example in a static JSON representation.
311 312 313 |
# File 'lib/rubyvis/layout/network.rb', line 311 def target @target end |
#target_node ⇒ Object
The link’s target node. If not set, this value will be derived from the target attribute index.
295 296 297 |
# File 'lib/rubyvis/layout/network.rb', line 295 def target_node @target_node end |
#value ⇒ Object
Alias for linkValue. This attribute is not populated automatically, but may be used instead of the linkValue attribute when specifying links.
317 318 319 |
# File 'lib/rubyvis/layout/network.rb', line 317 def value @value end |