public static Graph<Node, Edge> read(String filename) throws IOException, ParserConfigurationException, SAXException {
		GraphMLReader<Graph<Node, Edge>, Node, Edge> graphMLReader;
		PajekNetReader<Graph<Node, Edge>, Node, Edge> pajekNetReader;
		Graph<Node, Edge> graph = null;
		
		if (filename.endsWith(".graphml")) {
			graphMLReader = new GraphMLReader<Graph<Node, Edge>, Node, Edge>(new NodeFactory(), new EdgeFactory());
			graph = new UndirectedSparseGraph<Node, Edge>();
			graphMLReader.load(filename, graph);

			Map<String, GraphMLMetadata<Node>> nodeMetadata = graphMLReader.getVertexMetadata();

			// setting data for nodes
			Set<String> keys = nodeMetadata.keySet();
			for (Node n : graph.getVertices()) {
				for (String key : keys) {
					if (!nodeMetadata.get(key).transformer.transform(n).equals("")) {
						n.getData().put(key, nodeMetadata.get(key).transformer.transform(n));
					}
				}
				// by default, at beginning all belongs to the same group
				n.setGroup("0");
			}
		} else if (filename.endsWith(".paj")) {
			pajekNetReader = new PajekNetReader<Graph<Node, Edge>, Node, Edge>(new NodeFactory(), new EdgeFactory());
			graph = new UndirectedSparseGraph<Node, Edge>();
			pajekNetReader.load(filename, graph);

			for (Node n : graph.getVertices()) {
				n.getData().put("id", pajekNetReader.getVertexLabeller().transform(n));
				n.setGroup("0");
			}
		}
//		System.out.println(graph.getVertexCount());
//		System.out.println(graph.getEdgeCount());
		return graph;
	}