Skip to content

Instantly share code, notes, and snippets.

@Lesmiscore
Last active December 3, 2020 06:52
Show Gist options
  • Save Lesmiscore/564698a08572a86927024ed27a977429 to your computer and use it in GitHub Desktop.
Save Lesmiscore/564698a08572a86927024ed27a977429 to your computer and use it in GitHub Desktop.
// https://github.com/mdr/ascii-graphs
@Grapes([
@Grab('org.scala-lang:scala-library:2.10.1'),
@Grab('com.github.mdr:ascii-graphs_2.10:0.0.6')
])
import com.github.mdr.ascii.graph.*
import com.github.mdr.ascii.layout.*
import scala.Tuple2
import scala.collection.JavaConversions
def graph = new Graph(
JavaConversions.asScalaBuffer(["V1", "V2", "V3", "V4", "V5", "V6", "V7"]).toSet(),
JavaConversions.asScalaBuffer([
new Tuple2("V1", "V2"),
new Tuple2("V7", "V1"),
new Tuple2("V1", "V3"),
new Tuple2("V1", "V4"),
new Tuple2("V2", "V5"),
new Tuple2("V2", "V6")
]).toList()
)
def ascii = GraphLayout.renderGraph(graph)
println(ascii)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment