-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (34 loc) · 969 Bytes
/
main.go
File metadata and controls
43 lines (34 loc) · 969 Bytes
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
package main
import (
"context"
"fmt"
"github.com/specterops/dawgs"
"github.com/specterops/dawgs/container"
"github.com/specterops/dawgs/database/pg"
"github.com/specterops/dawgs/graph"
"github.com/specterops/dawgs/query"
)
func main() {
ctx, done := context.WithCancel(context.Background())
defer done()
dbInst, err := dawgs.Open(ctx, pg.DriverName, dawgs.Config{
ConnectionString: "user=postgres dbname=bhe password=bhe4eva host=localhost",
})
if err != nil {
panic(err)
}
metaKinds := graph.Kinds{
graph.StringKind("Meta"),
graph.StringKind("MetaDetail"),
}
kindFilter := query.And(
query.Not(query.Start().Kinds().HasOneOf(metaKinds)),
query.Not(query.End().Kinds().HasOneOf(metaKinds)),
)
if digraph, err := container.FetchTSDB(ctx, dbInst, kindFilter); err != nil {
panic(err)
} else {
fmt.Printf("Loaded %d nodes\n", digraph.Triplestore.NumNodes())
// algo.CalculateKatzCentrality(digraph, 0.01, 1, 0.01, 1000)
}
}