// StronglyConnected returns the list of strongly connected components
// within the Graph g. This information is primarily used by this package
// for cycle detection, but strongly connected components have widespread
// use.
512626
func StronglyConnected(g *Graph) [][]Vertex {
	vs := g.Vertices()
	acct := sccAcct{
		NextIndex:   1,
		VertexIndex: make(map[Vertex]int, len(vs)),
	}
	for _, v := range vs {
		// Recurse on any non-visited nodes
		if acct.VertexIndex[v] == 0 {
			stronglyConnected(&acct, g, v)
		}
	}
	return acct.SCC
}
1120628
func (g *Graph) Connect(edge Edge) {
	g.init()
	g.debug.Connect(edge)

	source := edge.Source()
	target := edge.Target()
	sourceCode := hashcode(source)
	targetCode := hashcode(target)

	// Do we have this already? If so, don't add it again.
	if s, ok := g.downEdges[sourceCode]; ok && s.Include(target) {
		return
	}

	// Add the edge to the set
	g.edges.Add(edge)

	// Add the down edge
	s, ok := g.downEdges[sourceCode]
	if !ok {
		s = new(Set)
		g.downEdges[sourceCode] = s
	}
	s.Add(target)

	// Add the up edge
	s, ok = g.upEdges[targetCode]
	if !ok {
		s = new(Set)
		g.upEdges[targetCode] = s
	}
	s.Add(source)
}
1182914
func (b *Broker) Connected() (bool, error) {
	b.lock.Lock()
	defer b.lock.Unlock()

	return b.conn != nil, b.connErr
}
1370185
func (c *Catalog) ConnectMultipleTags(service string, tags []string, q *QueryOptions) ([]*CatalogService, *QueryMeta, error) {
	return c.service(service, tags, q, true)
}
1117768
func (rin *relationNetworksState) Networks(relationKey string) (RelationNetworks, error) {
	coll, closer := rin.st.db().GetCollection(relationNetworksC)
	defer closer()

	var doc relationNetworksDoc
	err := coll.FindId(relationNetworkDocID(relationKey, rin.direction, relationNetworkAdmin)).One(&doc)
	if err == mgo.ErrNotFound {
		err = coll.FindId(relationNetworkDocID(relationKey, rin.direction, relationNetworkDefault)).One(&doc)
	}
	if err == mgo.ErrNotFound {
		return nil, errors.NotFoundf("%v networks for relation %v", rin.direction, relationKey)
	}
	if err != nil {
		return nil, errors.Trace(err)
	}
	return &relationNetworks{
		st:  rin.st,
		doc: doc,
	}, nil
}
121266
func (obj *Doc) GetConnectionsRaw(ctx context.Context) (json.RawMessage, error) {
	result := &struct {
		Connections json.RawMessage	`json:"qConnections"`
	} {}
	err := obj.rpc(ctx, "GetConnections", result)
	return result.Connections, err 
}
578953
func (b *BtcdNotifier) onBlockConnected(hash *chainhash.Hash, height int32, t time.Time) {
	// Append this new chain update to the end of the queue of new chain
	// updates.
	b.chainUpdates.ChanIn() <- &chainUpdate{
		blockHash:   hash,
		blockHeight: height,
		connect:     true,
	}
}
1372795
func EnsureImageComponentLayerNode(g osgraph.MutableUniqueGraph, name string) graph.Node {
	return ensureImageComponentNode(g, name, ImageComponentTypeLayer)
}
1169576
func Components(g Iterator) [][]int {
	sets, count := components(g)

	m := make([][]int, g.Order())
	for v := range m {
		x := sets.find(v)
		m[x] = append(m[x], v)
	}

	components := make([][]int, 0, count)
	for _, comp := range m {
		if comp != nil {
			components = append(components, comp)
		}
	}
	return components
}
1067666
func (graphite *Graphite) Connect() error {
	if !graphite.IsNop() {
		if graphite.conn != nil {
			graphite.conn.Close()
		}

		address := fmt.Sprintf("%s:%d", graphite.Host, graphite.Port)

		if graphite.Timeout == 0 {
			graphite.Timeout = defaultTimeout * time.Second
		}

		var err error
		var conn net.Conn

		if graphite.Protocol == "udp" {
			udpAddr, err := net.ResolveUDPAddr("udp", address)
			if err != nil {
				return err
			}
			conn, err = net.DialUDP(graphite.Protocol, nil, udpAddr)
		} else {
			conn, err = net.DialTimeout(graphite.Protocol, address, graphite.Timeout)
		}

		if err != nil {
			return err
		}

		graphite.conn = conn
	}

	return nil
}
225848
func (r Network_SecurityGroup) DetachNetworkComponents(networkComponentIds []int) (resp datatypes.Network_SecurityGroup_Request, err error) {
	params := []interface{}{
		networkComponentIds,
	}
	err = r.Session.DoRequest("SoftLayer_Network_SecurityGroup", "detachNetworkComponents", params, &r.Options, &resp)
	return
}
266047
func (e *etcdClient) Connected() <-chan struct{} {
	select {
	case <-e.firstSession:
		out := make(chan struct{})
		go func() {
		getSession:
			e.RLock()
			ch := e.session.Done()
			e.RUnlock()
			select {
			case <-ch:
				// this case means we are disconnected as the e.session.Done() was
				// closed. We will polling until we have a new etcd session and
				// we are connected to the kvstore.
				time.Sleep(100 * time.Millisecond)
				goto getSession
			default:
				close(out)
			}
		}()
		return out
	default:
		// We assume when the e.firstSession is closed that we have connectivity
		// with the kvstore as this channel is closed when we have the first
		// session.
		return e.firstSession
	}
}
447949
func (m *MockMetricsCollector) Connections() prometheus.Gauge {
	ret := m.ctrl.Call(m, "Connections")
	ret0, _ := ret[0].(prometheus.Gauge)
	return ret0
}
982405
func (n NetworkMode) ConnectedContainer() string {
	parts := strings.SplitN(string(n), ":", 2)
	if len(parts) > 1 {
		return parts[1]
	}
	return ""
}
160012
func (d *database) Graphs(ctx context.Context) ([]Graph, error) {
	req, err := d.conn.NewRequest("GET", path.Join(d.relPath(), "_api/gharial"))
	if err != nil {
		return nil, WithStack(err)
	}
	resp, err := d.conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(200); err != nil {
		return nil, WithStack(err)
	}
	var data getGraphsResponse
	if err := resp.ParseBody("", &data); err != nil {
		return nil, WithStack(err)
	}
	result := make([]Graph, 0, len(data.Graphs))
	for _, info := range data.Graphs {
		g, err := newGraph(info.Key, d)
		if err != nil {
			return nil, WithStack(err)
		}
		result = append(result, g)
	}
	return result, nil
}
402545
func (c *Connection) connected(status bool) {
	c.connectedLock.Lock()
	defer c.connectedLock.Unlock()
	c.Connected = status
}
763200
func (c *Client) IsConnected() bool {
	c.RLock()
	defer c.RUnlock()
	switch {
	case c.status == connected:
		return true
	case c.options.AutoReconnect && c.status > disconnected:
		return true
	default:
		return false
	}
}