Ask Your Question

Revision history [back]

As the error message, says, there is a problem with the indentation of your code, your 3 lines must start in the same row, like this:

import networkx as nx
FG=nx.Graph()
FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

not like this:

import networkx as nx
 FG=nx.Graph()
 FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

As the error message, says, there is a problem with the indentation of your code, your 3 lines must start in the same row, like this:

import networkx as nx
FG=nx.Graph()
FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

not like this:

import networkx as nx
 FG=nx.Graph()
 FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

This is a feature of Python: "statement grouping is done by indentation instead of beginning and ending brackets".

As the error message, says, there is a problem with the indentation of your code, your 3 lines must start in the same row, like this:

import networkx as nx
FG=nx.Graph()
FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

not like this:

import networkx as nx
 FG=nx.Graph()
 FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

This is a feature of Python: Python (the programming language on which Sage is based): "statement grouping is done by indentation instead of beginning and ending brackets".

As the error message, says, there is a problem with the indentation of your code, your 3 lines must start in the same row, column, like this:

import networkx as nx
FG=nx.Graph()
FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

not like this:

import networkx as nx
 FG=nx.Graph()
 FG.add_weighted_edges_from([(1,2,41),(1,3,75),(2,4,23),(3,4,81),(3,2,43),(4,5,25),(5,2,45)])

This is a feature of Python (the programming language on which Sage is based): "statement grouping is done by indentation instead of beginning and ending brackets".