Class: CycleDetector::GraphMLPrintStrategy
- Inherits:
-
Object
- Object
- CycleDetector::GraphMLPrintStrategy
- Defined in:
- lib/kwala/lib/cycle_detector.rb
Instance Method Summary collapse
-
#initialize ⇒ GraphMLPrintStrategy
constructor
A new instance of GraphMLPrintStrategy.
- #print_cycles(cycles) ⇒ Object
- #print_graph(graph) ⇒ Object
Constructor Details
#initialize ⇒ GraphMLPrintStrategy
Returns a new instance of GraphMLPrintStrategy.
460 461 462 463 464 465 |
# File 'lib/kwala/lib/cycle_detector.rb', line 460 def initialize @visited = Hash.new(false) @edges = [] @nodeid = Hash.new @cid = 0 end |
Instance Method Details
#print_cycles(cycles) ⇒ Object
484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/kwala/lib/cycle_detector.rb', line 484 def print_cycles(cycles) print_ml_wrapper do if cycles.size > 0 cycles.each do |path| puts "Nothing" end end end end |
#print_graph(graph) ⇒ Object
467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 |
# File 'lib/kwala/lib/cycle_detector.rb', line 467 def print_graph(graph) print_ml_wrapper do #print_sub_clusers(graph.keys) # Reorder the nodes based upon if it has edges or not. # Prefuse, fails if the first nodes do not have any links to # or from it. noedge, edge = graph.sort.partition { |k,v| v.edges.empty? } (edge + noedge).each do |k, v| print_node(v) end print_edges end end |