本文整理汇总了Golang中github.com/timtadh/goiso.SubGraph类的典型用法代码示例。如果您正苦于以下问题:Golang SubGraph类的具体用法?Golang SubGraph怎么用?Golang SubGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SubGraph类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Has
func (self *Fs2UniqueIndex) Has(sg *goiso.SubGraph) bool {
self.mutex.Lock()
defer self.mutex.Unlock()
key := sg.Serialize()
if len(key) < 0 {
panic(fmt.Errorf("Could not serialize sg, %v\n%v\n%v", len(key), sg, key))
}
has, err := self.bpt.Has(key)
assert_ok(err)
return has
}
开发者ID:timtadh,项目名称:graple,代码行数:11,代码来源:fs_unique.go
示例2: send
func (c *ParCollector) send(sg *goiso.SubGraph) {
label := sg.ShortLabel()
lg := &labelGraph{label, sg}
bkt := hash(label) % len(c.chs)
next := bkt
for i := 0; i < len(c.chs); i++ {
select {
case c.chs[next] <- lg:
return
default:
next = (next + 1) % len(c.chs)
}
}
c.chs[bkt] <- lg
}
开发者ID:timtadh,项目名称:graple,代码行数:15,代码来源:collectors.go
示例3: Add
func (self *Fs2UniqueIndex) Add(sg *goiso.SubGraph) {
self.mutex.Lock()
defer self.mutex.Unlock()
if sg == nil {
panic(fmt.Errorf("sg was a nil\n%p", sg))
}
key := sg.Serialize()
if len(key) < 0 {
panic(fmt.Errorf("Could not serialize sg, %v\n%v\n%v", len(key), sg, key))
}
assert_ok(self.bpt.Add(key, []byte{}))
has, err := self.bpt.Has(key)
assert_ok(err)
if !has {
panic("didn't have key just added")
}
// assert_ok(self.bf.Sync())
}
开发者ID:timtadh,项目名称:graple,代码行数:18,代码来源:fs_unique.go
示例4: PrMatrices
func (m *RandomWalkMiner) PrMatrices(sg *goiso.SubGraph) (vp int, Q, R, u Sparse, err error) {
defer func() {
if e := recover(); e != nil {
stack := string(debug.Stack())
err = fmt.Errorf("%v\n%v", e, stack)
}
}()
lattice := sg.Lattice()
log.Printf("lattice size %d %v", len(lattice.V), sg.Label())
p := m.probabilities(lattice)
log.Println("got transistion probabilities", p)
vp = m.startingPoints.Size()
Q = Sparse{
Rows: len(lattice.V) - 1,
Cols: len(lattice.V) - 1,
Entries: make([]*SparseEntry, 0, len(lattice.V)-1),
}
R = Sparse{
Rows: len(lattice.V) - 1,
Cols: 1,
Entries: make([]*SparseEntry, 0, len(lattice.V)-1),
}
u = Sparse{
Rows: 1,
Cols: len(lattice.V) - 1,
Entries: make([]*SparseEntry, 0, len(lattice.V)-1),
}
for i, x := range lattice.V {
if len(x.V) == 1 && len(x.E) == 0 && i < len(lattice.V)-1 {
u.Entries = append(u.Entries, &SparseEntry{0, i, 1.0 / float64(vp), vp})
}
}
for _, e := range lattice.E {
if e.Targ >= len(lattice.V)-1 {
R.Entries = append(R.Entries, &SparseEntry{e.Src, 0, 1.0 / float64(p[e.Src]), p[e.Src]})
} else {
Q.Entries = append(Q.Entries, &SparseEntry{e.Src, e.Targ, 1.0 / float64(p[e.Src]), p[e.Src]})
}
}
return vp, Q, R, u, nil
}
开发者ID:timtadh,项目名称:graple,代码行数:41,代码来源:random_walk.go
示例5: Add
func (self *Fs2BpTree) Add(key []byte, sg *goiso.SubGraph) {
self.mutex.Lock()
defer self.mutex.Unlock()
if len(key) < 0 {
panic(fmt.Errorf("Key was a bad value %d %v %p\n%p", len(key), key, key, sg))
}
if sg == nil {
panic(fmt.Errorf("sg was a nil %d %v %p\n%p", len(key), key, key, sg))
}
value := sg.Serialize()
if len(value) < 0 {
panic(fmt.Errorf("Could not serialize sg, %v\n%v\n%v", len(value), sg, value))
}
assert_ok(self.bpt.Add(key, value))
has, err := self.bpt.Has(key)
assert_ok(err)
if !has {
panic("didn't have key just added")
}
// assert_ok(self.bf.Sync())
}
开发者ID:timtadh,项目名称:graple,代码行数:21,代码来源:fs.go
示例6: serializeValue
func serializeValue(value *goiso.SubGraph) []byte {
return value.Serialize()
}
开发者ID:timtadh,项目名称:graple,代码行数:3,代码来源:fs.go
示例7: SerializeSubGraph
func SerializeSubGraph(sg *goiso.SubGraph) []byte {
return sg.Serialize()
}
开发者ID:timtadh,项目名称:sfp,代码行数:3,代码来源:types.go
注:本文中的github.com/timtadh/goiso.SubGraph类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论