<｜begin▁of▁sentence｜>### Instruction:
Given a file 'path_to_edgelist.txt' containing an edge list with each line formatted as 'node1 node2' (where node1 and node2 are integers representing nodes), and another file 'path_to_edgelist_with_data.txt' with each line formatted as 'node1,node2,weight' (with comments marked by a '%'), how can we read these files into a NetworkX graph, considering weights as a float data type for the edges, and nodes as integers?
### Response:
import networkx as nx

# Read simple edge list
G = nx.read_edgelist('path_to_edgelist.txt', nodetype=int)

# Read with comments and data, using a comma as a delimiter
G = nx.read_edgelist('path_to_edgelist_with_data.txt', comments='%', delimiter=',', data=[('weight', float)], nodetype=int, encoding='utf-8')

# Display number of nodes and edges
print('Number of nodes:', G.number_of_nodes())
print('Number of edges:', G.number_of_edges())

# Print the edges with data
print(list(G.edges(data=True)))
<|EOT|>
