Repository navigation
Expand file tree
/
Copy pathSigmaGraph.NET.fsx
More file actions
73 lines (56 loc) · 2.11 KB
/
Copy pathSigmaGraph.NET.fsx
File metadata and controls
73 lines (56 loc) · 2.11 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#r "nuget: DynamicObj, 2.0.0"
#r "nuget: Newtonsoft.Json"
#r "nuget: Giraffe.ViewEngine, 1.4.0"
#r "./bin/Release/net8.0/SigmaGraph.NET.dll"
#r "nuget: Graphoscope, 0.4.0"
open SigmaGraph.NET
open System
open System.IO
open Newtonsoft.Json
open Graphoscope
open Graphoscope.RandomModels
let colors = [|"#F2FFE9";"#A6CF98";"#557C55";"#FA7070"|]
let N = 50
let p = 0.005
let rnd = new Random()
let random_number = rnd.Next(1, 51)
//let myGilbertGraph = Gilbert.initDirectedFGraph N p
let myBollobasRiordan = RandomModels.BollobasRiordan.initDirectedFGraph N 0.5 0.1 0.4 0.6 0.4 FGraph.empty
VisGraph.empty()
|> VisGraph.withNodes[
for node in myBollobasRiordan do
yield (Node.Init(key=string node.Key,DisplayData=DisplayData.Init(Size=rnd.Next(1, 18), Color=colors.[rnd.Next(0, 4)], Label=string node.Key)))
]
|> VisGraph.withEdges [
for node in myBollobasRiordan do
let pred,t,_ = node.Value
for kv in pred do
yield (Edge.Init(source=string kv.Key, target=string t,DisplayData=DisplayData.Init(Size=rnd.Next(1, 3))) )
]
// |> VisGraph.withForceAtlas2(Iterations=100,Settings=FA2Settings.Init(AdjustSizes=true,Gravity=5),GetEdgeWeight="size")
// |> VisGraph.withNoverlap(50)
|> VisGraph.withCircularLayout()
|> VisGraph.withRenderer(Render.Settings.Init(LabelColor=Render.ColorOrReference.Init(Color="#FA7070"))) // , DefaultEdgeType=StyleParam.EdgeType.Curve))
|> VisGraph.withHoverSelector()
|> VisGraph.show()
// let jsonTxt = File.ReadAllText("D:/Source/sigmaNET/src/sigmaNET/data.json")
// let data = JsonConvert.DeserializeObject<GraphData>(jsonTxt)
// Graph.empty()
// |> Graph.withNodes data.Nodes
// |> Graph.withEdges data.Edges
// |> Graph.withForceAtlas2(Iterations=100,Settings=FA2Settings.Init(AdjustSizes=true,Gravity=10))
// |> Graph.show()
// SigmaSetting:
// settings: {
// sideMargin: 10,
// minEdgeSize: 2,
// maxEdgeSize: 2,
// minNodeSize: 3,
// maxNodeSize: 14,
// labelThreshold: 2,
// labelAlignment: 'center',
// nodesPowRatio: 1.3,
// edgesPowRatio: 1,
// autoResize: true,
// autoRescale: true,
// labelSizeRatio: 20,