t...@thsu.org writes:
> On Sep 2, 9:54 am, Bart Kastermans wrote:
>> if d(a,b) == 1 and a < b:
>
> It will probably be faster if you reverse the evaluation order of that
> expression.
>
> if a
> That way the d() function is called less than half the time. Of course
> this assumes that a that's tr
On Sep 2, 9:54 am, Bart Kastermans wrote:
> if d(a,b) == 1 and a < b:
It will probably be faster if you reverse the evaluation order of that
expression.
if ahttp://mail.python.org/mailman/listinfo/python-list
MRAB writes:
> On 02/09/2011 01:35, Bart Kastermans wrote:
>> graph = [[a,b] for a in data for b in data if d(a,b) ==1 and a< b]
>> graph2 = []
>> for i in range (0, len(data)):
>> for j in range(0,len(data)):
>> if d(data[i],data[j]) == 1 and i< j:
>> graph2.append
On 02/09/2011 01:35, Bart Kastermans wrote:
In the following code I create the graph with vertices
sgb-words.txt (the file of 5 letter words from the
stanford graphbase), and an edge if two words differ
by one letter. The two methods I wrote seem to me to
likely perform the same computations, t
In the following code I create the graph with vertices
sgb-words.txt (the file of 5 letter words from the
stanford graphbase), and an edge if two words differ
by one letter. The two methods I wrote seem to me to
likely perform the same computations, the list comprehension
is faster though (281