Esempio n. 1
0
        public void gust0()
        {
            IIteratorInstance <IKVPair <IVertex, IDataTriangle> > output_value_instance = (IIteratorInstance <IKVPair <IVertex, IDataTriangle> >)Output.Instance;
            IEnumerator <int> V = g.vertexSet().GetEnumerator();

            while (V.MoveNext())
            {
                int v = V.Current;
                if (!isGhost(v))
                {
                    ICollection <int> vneighbors = g.neighborsOf(v);
                    foreach (int w in vneighbors)
                    {
                        if (v < w)                           //buscam-se os vérices maiores que v e com partições distintas
                        {
                            if (partition[v - 1] != partition[w - 1])
                            {
                                IKVPairInstance <IVertex, IDataTriangle> item = (IKVPairInstance <IVertex, IDataTriangle>)Output.createItem();
                                ((IVertexInstance)item.Key).Id        = w;
                                ((IDataTriangleInstance)item.Value).V = v;
                                output_value_instance.put(item);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        }                                            // Isso é necessário no caso de IKey ser do tipo IVertex.

        #endregion

        #region Algorithm implementation
        public void startup_push()
        {
            IIteratorInstance <IKVPair <IVertex, IDataTriangle> > output_value_instance = (IIteratorInstance <IKVPair <IVertex, IDataTriangle> >)Output.Instance;
            IEnumerator <int> V = g.vertexSet().GetEnumerator();

            while (V.MoveNext())
            {
                int v = V.Current;
                if (!isGhost(v))
                {
                    ICollection <int> vneighbors = g.neighborsOf(v);
                    foreach (int w in vneighbors)
                    {
                        if (v < w)                           //buscam-se os vérices maiores
                        {
                            if (isGhost(w))
                            {
                                IKVPairInstance <IVertex, IDataTriangle> item = (IKVPairInstance <IVertex, IDataTriangle>)Output.createItem();
                                IVertexInstance       ok = (IVertexInstance)item.Key;
                                IDataTriangleInstance ov = (IDataTriangleInstance)item.Value;
                                ok.Id = w;
                                ov.V  = v;
                                output_value_instance.put(item);
                            }
                            else
                            {
                                IList <KeyValuePair <int, int> > l;
                                if (!triangles.TryGetValue(v, out l))
                                {
                                    l            = new List <KeyValuePair <int, int> > ();
                                    triangles[v] = l;
                                }

                                IEnumerator <int> wneighbors = g.iteratorNeighborsOf(w);
                                while (wneighbors.MoveNext())
                                {
                                    int z = wneighbors.Current;
                                    if (w < z && vneighbors.Contains(z))
                                    {
                                        l.Add(new KeyValuePair <int, int> (w, z));

                                        count++;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public void gust0()
        {
            IIteratorInstance <IKVPair <IVertex, IDataTriangle> > output_value = (IIteratorInstance <IKVPair <IVertex, IDataTriangle> >)Output.Instance;
            IEnumerator <int> V = g.vertexSet().GetEnumerator();

            while (V.MoveNext())
            {
                int v = V.Current;
                if (!isGhost(v))
                {
                    ICollection <int> vneighbors = g.neighborsOf(v);
                    foreach (int w in vneighbors)
                    {
                        if (v < w)                           //buscam-se os vérices maiores
                        {
                            if (!isGhost(w))
                            {
                                IList <KeyValuePair <int, int> > l;
                                if (!triangles.TryGetValue(v, out l))
                                {
                                    l            = new List <KeyValuePair <int, int> > ();
                                    triangles[v] = l;
                                }
                                IEnumerator <int> wneighbors = g.iteratorNeighborsOf(w);
                                while (wneighbors.MoveNext())
                                {
                                    int z = wneighbors.Current;
                                    if (w < z && vneighbors.Contains(z))
                                    {
                                        l.Add(new KeyValuePair <int, int> (w, z));
                                        count++;
                                        //emite (v, w, z, output_value);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            foreach (int id in first_ids_found)
            {
                if (!isGhost(id))
                {
                    emite(id, this.partid, count, output_value);
                    break;
                }
            }
        }
Esempio n. 4
0
        public void startup_push()
        {
            IIteratorInstance <IKVPair <IVertex, IDataTriangle> > output_value_instance = (IIteratorInstance <IKVPair <IVertex, IDataTriangle> >)Output.Instance;
            int v, ordered, i, j;
            IEnumerator <int> V = g.vertexSet().GetEnumerator();

            while (V.MoveNext())
            {
                v = V.Current;
                if (!isGhost(v))
                {
                    IEnumerator <int> vneighbors = g.iteratorNeighborsOf(v);
                    while (vneighbors.MoveNext())
                    {
                        int bigger = vneighbors.Current;
                        if (v < bigger)                           //buscam-se os vérices maiores
                        {
                            if (isGhost(bigger))
                            {
                                IKVPairInstance <IVertex, IDataTriangle> item = (IKVPairInstance <IVertex, IDataTriangle>)Output.createItem();
                                IVertexInstance       ok = (IVertexInstance)item.Key;
                                IDataTriangleInstance ov = (IDataTriangleInstance)item.Value;
                                ok.Id = bigger;
                                ov.V  = v;
                                output_value_instance.put(item);
                            }
                            else
                            {
                                IList <KeyValuePair <int, int> > l;
                                if (!messages.TryGetValue(bigger, out l))
                                {
                                    l = new List <KeyValuePair <int, int> > ();
                                    messages[bigger] = l;
                                }
                                l.Add(new KeyValuePair <int, int>(v, 0));
                            }
                        }
                    }
                }
            }
        }