Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for TransitiveReduction (0.28 sec)

  1. src/internal/dag/alg_test.go

    func TestTransitiveReduction(t *testing.T) {
    	t.Run("diamond", func(t *testing.T) {
    		g := mustParse(t, diamond)
    		g.TransitiveReduction()
    		wantEdges(t, g, "b->a c->a d->b d->c")
    	})
    	t.Run("chain", func(t *testing.T) {
    		const chain = `NONE < a < b < c < d; a, d < e;`
    		g := mustParse(t, chain)
    		g.TransitiveReduction()
    		wantEdges(t, g, "e->d d->c c->b b->a")
    	})
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 04 15:31:44 UTC 2022
    - 1.1K bytes
    - Viewed (0)
  2. src/internal/dag/alg.go

    		visit(root)
    	}
    	for i, j := 0, len(topo)-1; i < j; i, j = i+1, j-1 {
    		topo[i], topo[j] = topo[j], topo[i]
    	}
    	return topo
    }
    
    // TransitiveReduction removes edges from g that are transitively
    // reachable. g must be transitively closed.
    func (g *Graph) TransitiveReduction() {
    	// For i -> j -> k, if i -> k exists, delete it.
    	for _, i := range g.Nodes {
    		for _, j := range g.Nodes {
    			if g.HasEdge(i, j) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 04 15:31:44 UTC 2022
    - 1.3K bytes
    - Viewed (0)
  3. src/runtime/mklockrank.go

    		os.Exit(2)
    	}
    
    	g, err := dag.Parse(ranks)
    	if err != nil {
    		log.Fatal(err)
    	}
    
    	var out []byte
    	if *flagDot {
    		var b bytes.Buffer
    		g.TransitiveReduction()
    		// Add cyclic edges for visualization.
    		for k := range cyclicRanks {
    			g.AddEdge(k, k)
    		}
    		// Reverse the graph. It's much easier to read this as
    		// a "<" partial order than a ">" partial order. This
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 17:47:01 UTC 2024
    - 9.1K bytes
    - Viewed (0)
Back to top