forked from eosfor/PSGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleGraphSample2.ps1
More file actions
50 lines (34 loc) · 1.31 KB
/
Copy pathsimpleGraphSample2.ps1
File metadata and controls
50 lines (34 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#create a new graph
$g = New-Graph
#add vertices
# [char]'A'..[char]'P' | % { Add-Vertex -Vertex ([string]([char]$_)) -Graph $g } | Out-Null
'A', 'B', 'C', 'D','G' | % { Add-Vertex -Vertex ([string]([char]$_)) -Graph $g } | Out-Null
#add edges
Add-Edge -From A -To C -Graph $g | Out-Null
Add-Edge -From A -To D -Graph $g | Out-Null
Add-Edge -From B -To G -Graph $g | Out-Null
Add-Edge -From C -to A -Graph $g | Out-Null
Add-Edge -From C -To B -Graph $g | Out-Null
Add-Edge -From C -To G -Graph $g | Out-Null
Add-Edge -From D -To B -Graph $g | Out-Null
Add-Edge -From G -To D -Graph $g | Out-Null
#tmpFileNames
$dotFileName = "testGraph1.gv"
$svgFileName = "testGraph1.svg"
#Export graph
if ($IsMacOS) {
$graphFile = Join-Path -Path $env:TMPDIR -ChildPath $dotFileName
$svgOutFile = Join-Path -Path $env:TMPDIR -ChildPath $svgFileName
}
if ($IsWindows) {
$graphFile = Join-Path -Path $env:TMP -ChildPath $dotFileName
$svgOutFile = Join-Path -Path $env:TMP -ChildPath $svgFileName
}
Export-Graph -Graph $g -Format Graphviz -Path $graphFile
dot -Tsvg $graphFile -o $svgOutFile
# $graphFile
# $svgOutFile
$d = New-DSM -Graph $g
# Start-DSMClustering -Dsm $d
Export-DSM -Dsm $d -Path $Env:TMPDIR/dsm.txt -Format TEXT
dot -Tsvg $graphFile -o $env:TMPDIR/srcGraph.svg