Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.io
Class BipartiteGraphReader

    java.lang.Object
      edu.uci.ics.jung.io.BipartiteGraphReader

public class BipartiteGraphReader
extends Object

Author:
  Joshua O'Madadhain

Field Summary
`protected boolean` | `asList` If `true`, specifies that each line of input implicitly represents a list of edges, where the first token specifies one endpoint, and the subsequent tokens specify a sequence of opposite endpoints.
`protected boolean` | `directed` If `true`, the edges created will be directed; otherwise, they will be undirected.
`protected boolean` | `parallel` If `true`, parallel edges may be created if the edge is found more than once in the input file.
`static UserDatumVertexPredicate` | `PART_A` The predicate for the vertices in partitions A and B.
`static UserDatumVertexPredicate` | `PART_B`
`static String` | `PARTITION` The user data key for the vertices' partitions.

Constructor Summary
`BipartiteGraphReader()` Creates a BipartiteGraphReader with default behavior (one edge per line, undirected, no parallel edges created).
`BipartiteGraphReader(boolean asList, boolean directed, boolean parallel)`

Method Summary
`static Predicate` | `getPartition(Vertex v)`
`boolean` | `isAsList()`
`boolean` | `isDirected()`
`boolean` | `isParallel()`
`KPartiteGraph` | `load(Reader reader)` Creates a `KPartiteGraph` (where k = 2) based on connection data gathered from a Reader.
`void` | `setAsList(boolean asList)`
`void` | `setDirected(boolean directed)`
`void` | `setParallel(boolean parallel)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PARTITION

    public static final String PARTITION

  The user data key for the vertices' partitions.

  See Also:
    Constant Field Values

### PART_A

    public static final UserDatumVertexPredicate PART_A

  The predicate for the vertices in partitions A and B.

### PART_B

    public static final UserDatumVertexPredicate PART_B

### asList

    protected boolean asList

  If `true`, specifies that each line of input implicitly represents a list of edges, where the first token specifies one endpoint, and the subsequent tokens specify a sequence of opposite endpoints. Otherwise, each line of input represents a single edge.

### directed

    protected boolean directed

  If `true`, the edges created will be directed; otherwise, they will be undirected. In either case, the graph is constrained to accept only the specified edge type.

  NOTE: Currently, the data format specified only permits directed edges whose source is in partition A and whose destination is in partition B.

### parallel

    protected boolean parallel

  If `true`, parallel edges may be created if the edge is found more than once in the input file. Otherwise, each edge is labelled with a weight by an `EdgeWeightLabeller`, and the graph is created with the "no parallel edges" constraint. The weight of each edge in the non-parallel case is the number of times that the edge is represented in the input file (that is, the edge's multiplicity).

Constructor Detail

### BipartiteGraphReader

    public BipartiteGraphReader(boolean asList,
                                boolean directed,
                                boolean parallel)

### BipartiteGraphReader

    public BipartiteGraphReader()

  Creates a BipartiteGraphReader with default behavior (one edge per line, undirected, no parallel edges created).

Method Detail

### load

    public KPartiteGraph load(Reader reader)
                       throws IOException

  Creates a `KPartiteGraph` (where k = 2) based on connection data gathered from a Reader. The data must be in one of the two following formats:

       a_1 b_1
       a_2 b_1
       a_2 b_2
       a_3 b_3 ...

  or

        a_1 b_1 b_2 b_3
        a_2 b_2 b_3
        a_3 b_3 ...

  where `x_i` is a unique label (ID) for vertex `i` in partition `x`. Each line in the file defines an edge between the specified vertices. The vertices themselves are defined implicitly: if a label is read from the file for which no vertex yet exists, a new vertex is created and that label is attached to it.

  The first format is the default; the second is assumed if the `asList` flag is set to `true`. In the default format, everything after the first whitespace is interpreted as part of the label for the second vertex.

  Vertex labels are only required to be unique within their partitions. Each partition has its own `StringLabeller`, which is accessed via the key `VID_A` or `VID_B`, as appropriate.

  The end of the file may be artificially set by putting the string `end_of_file` on a line by itself.

  Returns:
    the 2-partite graph loaded with these vertices, and labelled with two StringLabellers
  Throws:
    `IOException` - May occur in the course of reading from a stream.

### getPartition

    public static Predicate getPartition(Vertex v)

### setAsList

    public void setAsList(boolean asList)

### setDirected

    public void setDirected(boolean directed)

### setParallel

    public void setParallel(boolean parallel)

### isAsList

    public boolean isAsList()

### isDirected

    public boolean isDirected()

### isParallel

    public boolean isParallel()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD