Beispiel #1
0
        private void graph_creator_aux(IInputFormatInstance gif)
        {
            for (int i = 0; i < gif.ESIZE;)
            {
                if (gif.Target [i] != 0)                   // Será usada a forma canonica: i->j, onde i<j, i>0 j>0
                {
                    int s = gif.Source [i] < gif.Target [i] ? gif.Source [i] : gif.Target [i];
                    int t = gif.Target [i] > gif.Source [i] ? gif.Target [i] : gif.Source [i];
                    g.addVertex(s);
                    g.addVertex(t);
                    g.noSafeAdd(s, t);
                    i++;
                }
            }
            IIteratorInstance <IKVPair <IInteger, IInputFormat> > output_gifs_instance = (IIteratorInstance <IKVPair <IInteger, IInputFormat> >)Output_gif.Instance;
            IKVPairInstance <IInteger, IInputFormat> item = (IKVPairInstance <IInteger, IInputFormat>)Output_gif.createItem();

            ((IIntegerInstance)item.Key).Value = gif.PARTID;
            item.Value = gif;
            output_gifs_instance.put(item);          // Emite-se gif novamente para que a funcão de particionamento do conector receba a instancia PartitionTABLE.
        }                                            // Isso é necessário no caso de IKey ser do tipo IVertex.
        private void graph_creator_aux(IInputFormatInstance gif)
        {
            for (int i = 0; i < gif.ESIZE;)
            {
                if (gif.Target [i] != 0)                   // Será usada a forma canonica: i->j, onde i<j, i>0 j>0
                {
                    int s = gif.Source [i] < gif.Target [i] ? gif.Source [i] : gif.Target [i];
                    int t = gif.Target [i] > gif.Source [i] ? gif.Target [i] : gif.Source [i];
                    g.addVertex(s);
                    g.addVertex(t);
                    g.noSafeAdd(s, t);                      //Usando noSafeAdd! Isso significa que erros no arquivo fonte não serão tratados.
                    i++;                                    //Ou seja, os dados serão inseridos da forma como chegam. Para tratamento, usa-se g.addEdge(s,t).
                }
            }
            IIteratorInstance <IKVPair <IInteger, IInputFormat> > output_gifs_instance = (IIteratorInstance <IKVPair <IInteger, IInputFormat> >)Output_gif.Instance;
            IKVPairInstance <IInteger, IInputFormat> item = (IKVPairInstance <IInteger, IInputFormat>)Output_gif.createItem();

            ((IIntegerInstance)item.Key).Value = gif.PARTID;
            item.Value = gif;
            output_gifs_instance.put(item);          // Emite-se gif novamente para que a funcão de particionamento do conector receba a instancia PartitionTABLE.
        }                                            // Isso é necessário no caso de IKey ser do tipo IVertex.
Beispiel #3
0
        private void graph_creator_aux(IInputFormatInstance gif)
        {
            for (int i = 0; i < gif.ESIZE; i++)
            {
                int s = gif.Source [i];
                int t = gif.Target [i];
                g.addVertex(s);
                g.addVertex(t);
                g.addEdge(s, t);
                if (s == 0 || t == 0)
                {
                    throw new ArgumentNullException("WARNING: Vertex id is 0! ");
                }
            }
            IIteratorInstance <IKVPair <IInteger, IInputFormat> > output_gifs_instance = (IIteratorInstance <IKVPair <IInteger, IInputFormat> >)Output_gif.Instance;
            IKVPairInstance <IInteger, IInputFormat> item = (IKVPairInstance <IInteger, IInputFormat>)Output_gif.createItem();

            ((IIntegerInstance)item.Key).Value = gif.PARTID;
            item.Value = gif;
            output_gifs_instance.put(item);
        }
        private void graph_creator_aux(IInputFormatInstance gif)
        {
            bool weighted = gif.Weight.Length == gif.Source.Length; float f = 1.0f;

            for (int i = 0; i < gif.ESIZE; i++)
            {
                int s = gif.Source [i];
                int t = gif.Target [i];
                if (weighted)
                {
                    f = gif.Weight [i];
                }
                g.addVertex(s);
                g.addVertex(t);
                g.noSafeAdd(s, t, f);
                if (s == 0 || t == 0)
                {
                    throw new ArgumentNullException("WARNING: Vertex id is 0! ");
                }
            }
            IIteratorInstance <IKVPair <IInteger, IInputFormat> > output_gifs_instance = (IIteratorInstance <IKVPair <IInteger, IInputFormat> >)Output_gif.Instance;
            IKVPairInstance <IInteger, IInputFormat> item = (IKVPairInstance <IInteger, IInputFormat>)Output_gif.createItem();

            ((IIntegerInstance)item.Key).Value = gif.PARTID;
            item.Value = gif;
            output_gifs_instance.put(item);
        }