Skip to content

Graph reading strategy

Inno Fang edited this page Jun 3, 2019 · 4 revisions

Choosing a graph reading strategy

This project include 4 graph reading strategy:

Of course you an customize the graph reading strategy, strategy can be implemented according to the format of data set. This can be accomplished by implementing the load method of DataSetStrategy.

public class CustomDataSet implements DataSetStrategy {
    @Override
    public List<Graph> load(String filePath) throws IOException {
        // ... 
    }
}

And the usage of strategy are as follow:

// specify the graph reading strategy
GraphReader reader = new GraphReader(); 
try {
    List<Graph> sourceGraphs = graphReader.read(sourceGraphFilePath);
    List<Graph> targetGraphs = graphReader.read(targetGraphFilePath);        
    
    // the following code ...
} catch (IOException e) {
    e.printStackTrace();
}