Documentation
¶
Index ¶
- type Graph
- func (self *Graph) AllFlags(n godip.Province) (result map[godip.Flag]bool)
- func (self *Graph) AllSCs() (result []godip.Province)
- func (self *Graph) Coasts(prov godip.Province) (result []godip.Province)
- func (self *Graph) Edges(n godip.Province, reverse bool) (result map[godip.Province]map[godip.Flag]bool)
- func (self *Graph) Flags(n godip.Province) (result map[godip.Flag]bool)
- func (self *Graph) Has(n godip.Province) (result bool)
- func (self *Graph) Nations() (result []godip.Nation)
- func (self *Graph) Path(first, last godip.Province, reverse bool, filter godip.PathFilter) []godip.Province
- func (self *Graph) Prov(n godip.Province) *SubNode
- func (self *Graph) Provinces() (result []godip.Province)
- func (self *Graph) SC(n godip.Province) (result *godip.Nation)
- func (self *Graph) SCs(n godip.Nation) (result []godip.Province)
- func (self *Graph) String() string
- type Node
- type SubNode
- func (self *SubNode) Conn(n godip.Province, flags ...godip.Flag) *SubNode
- func (self *SubNode) Done() *Graph
- func (self *SubNode) Flag(flags ...godip.Flag) *SubNode
- func (self *SubNode) Prov(n godip.Province) *SubNode
- func (self *SubNode) SC(n godip.Nation) *SubNode
- func (self *SubNode) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
func (*Graph) Edges ¶
func (self *Graph) Edges(n godip.Province, reverse bool) (result map[godip.Province]map[godip.Flag]bool)
Edges returns the edges leading away from the specified province, or if reverse is set to true then it instead returns the edges leading to it.
func (*Graph) Path ¶
func (self *Graph) Path(first, last godip.Province, reverse bool, filter godip.PathFilter) []godip.Province
Path returns a list of provinces that go from first to last. When reverse is set to true then all edges are traversed backwards (i.e. to find a root that a unit at last could use to get to first). The filter can be used to specify the type of provinces that the path can go through, but it can also be used as a callback function to allow extracting information about all potential matching paths (nb. last can be set to "" to use this callback with all reachable provinces from first).