Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
sarehu
Apr 20, 2007

(call/cc call/cc)
See the Learning Electronics MEGATHREAD.

Adbot
ADBOT LOVES YOU

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
Yes, that seems to be on the money. Thanks.

it is
Aug 19, 2011

by Smythe
I'm looking in a very badly-made HTML page for an element. The element has two descendants (not necessarily children): one is a div with the text, say, 'SpongeBob' and another is a div with the text, say, 'SquarePants.' What's the proper XPath for "a tr that has a descendant with this text and another descendant with that text?" Thanks!

redleader
Aug 18, 2005

Engage according to operational parameters

it is posted:

I'm looking in a very badly-made HTML page for an element. The element has two descendants (not necessarily children): one is a div with the text, say, 'SpongeBob' and another is a div with the text, say, 'SquarePants.' What's the proper XPath for "a tr that has a descendant with this text and another descendant with that text?" Thanks!


I work with lovely document structures on a daily basis. //tr[.//div[text() = 'Spongebob'] and .//div[text() = 'Squarepants']] might work for you, given an HTML structure like:

HTML code:
<html> 
  <body> 
    <table> 
      <tr> 
        <td><div>Spongebob</div></td>  
        <td><div>Squarepants</div></td> 
      </tr>  
      <tr> 
        <td><div>Some other stuff</div></td>  
        <td><div>Not Squarepants</div></td> 
      </tr> 
    </table> 
  </body> 
</html>
If you need to match any element containing that text, replace the div like so: //tr[.//*[text() = 'Spongebob'] and .//*[text() = 'Squarepants']].

//tr matches any and all <tr> elements in the document - you might want or need to change this to be more selective.
.//div matches all descendent divs of the current node (and .//* matches all descendent elements of any kind of the current node).

midnightclimax
Dec 3, 2011

by XyloJW
I'm trying to filter messages containing a specific sentence using maildrop/regex, but something's not working (hint: I'm not a coder)
/This\sis\the\ssentence\sI\sam\looking\sfor\,\salso\sa\scomma\./:b

So basically I thought this is enough to filter a message containing that string in the body of the message. But something fucks up and maildrop.log shows nothing and no messages get delivered. I'm guessing it's probably \./ and you need a double escape for the period? Whatever.

it is
Aug 19, 2011

by Smythe

redleader posted:

I work with lovely document structures on a daily basis. //tr[.//div[text() = 'Spongebob'] and .//div[text() = 'Squarepants']] might work for you, given an HTML structure like:

HTML code:
<html> 
  <body> 
    <table> 
      <tr> 
        <td><div>Spongebob</div></td>  
        <td><div>Squarepants</div></td> 
      </tr>  
      <tr> 
        <td><div>Some other stuff</div></td>  
        <td><div>Not Squarepants</div></td> 
      </tr> 
    </table> 
  </body> 
</html>
If you need to match any element containing that text, replace the div like so: //tr[.//*[text() = 'Spongebob'] and .//*[text() = 'Squarepants']].

//tr matches any and all <tr> elements in the document - you might want or need to change this to be more selective.
.//div matches all descendent divs of the current node (and .//* matches all descendent elements of any kind of the current node).

This was exactly what I was looking for. Thanks!

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

quote:

/This\sis\the\ssentence\sI\sam\looking\sfor\,\salso\sa\scomma\./:b

You're missing an "s" before "the". Right now you've got \the which is <tab>he, you want \sthe which is <whitespace>the.

A nice tool for visualizing regexes is Regexper.

http://regexper.com/#%2FThis%5Csis%5Cthe%5Cssentence%5CsI%5Csam%5Clooking%5Csfor%5C%2C%5Csalso%5Csa%5Cscomma%5C.%2F

midnightclimax
Dec 3, 2011

by XyloJW

Bognar posted:

You're missing an "s" before "the". Right now you've got \the which is <tab>he, you want \sthe which is <whitespace>the.

A nice tool for visualizing regexes is Regexper.

http://regexper.com/#%2FThis%5Csis%5Cthe%5Cssentence%5CsI%5Csam%5Clooking%5Csfor%5C%2C%5Csalso%5Csa%5Cscomma%5C.%2F

That was just an example, but I checked the original string again and found two errors. That Regexpr is a cool site, thanks.

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Could someone give a simple breakdown of what database schemas are and what part they play in projects? For some reason I'm not understanding what/why they are needed, or when I should be using one.

sarehu
Apr 20, 2007

(call/cc call/cc)
That's how SQL works. When you make a table you have to say what type of data is stored in each column. This lets the database run its queries faster, and it protects you from mistakes, and it describes connections between tables (with foreign keys) and other constraints (like uniqueness).

TheresaJayne
Jul 1, 2011

Hughmoris posted:

Could someone give a simple breakdown of what database schemas are and what part they play in projects? For some reason I'm not understanding what/why they are needed, or when I should be using one.

First if you want to save any data with your project you use a database, the Database Table is referred to as a Schema.
Any project that does something will use Schemas.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

Hughmoris posted:

Could someone give a simple breakdown of what database schemas are and what part they play in projects? For some reason I'm not understanding what/why they are needed, or when I should be using one.

Schemas are metatables. You know how a table is a list of your data? The schema is a list of columns you're using to organize that data.

Admiral Bosch
Apr 19, 2007
Who is Admiral Aken Bosch, and what is that old scoundrel up to?
Anybody in here familiar with G-code/machine code? I have a hand-programming class over the summer that I anticipate needing some help with, was curious whether anyone else used it for work.

LiterallyAnything
Jul 11, 2008

by vyelkin
Really simple Apache question- How do I get my access.log file to write out per day? Right now it's one giant combined file.

Completely overlooked this. Please ignore-

quote:

One important use of piped logs is to allow log rotation without having to restart the server. The Apache HTTP Server includes a simple program called rotatelogs for this purpose. For example, to rotate the logs every 24 hours, you can use:

CustomLog "|/usr/local/apache/bin/rotatelogs /var/log/access_log 86400" common

LiterallyAnything fucked around with this message at 17:15 on Jun 16, 2015

mobby_6kl
Aug 9, 2009

by Fluffdaddy

Hughmoris posted:

Could someone give a simple breakdown of what database schemas are and what part they play in projects? For some reason I'm not understanding what/why they are needed, or when I should be using one.

The other explanations are correct. But at least the recent SQL Server versions also have "schemas" as a kind of namespace for your poo poo to go into. Mainly they give you more granularity to control access to various objects in the database.
https://technet.microsoft.com/en-us/library/dd283095(v=sql.100).aspx

Amberskin
Dec 22, 2013

We come in peace! Legit!

Hughmoris posted:

Could someone give a simple breakdown of what database schemas are and what part they play in projects? For some reason I'm not understanding what/why they are needed, or when I should be using one.

Adding to other replies you have got already, there are some further case uses for schemas:

- They add an additional namespace level to the database objects, so you can have a LOANS.JOURNAL and a CHECKING.JOURNAL tables in the same database, without name crashing.

- You can have different schemas with the same identical tables, for testing, pre-production and production work. You do not specify the schema names in your DML SQL (i.e., you do not qualify the table names), and establish the "default" schema either at the package level (DB2) or in the connection string (i.e., JDBC URI).

- You can use schemas to implement multitenancy, basically in the same way (you select the schema at run time, using different datasources pointing to different schemas).

In the DB2 world, 'schemas' are quite equivalent to 'owners'. In the mainframe version, for instance, your SQL (both DML and DDL) is qualified with your userid by default, so all your tables go under USERID.tablename names.

Grundulum
Feb 28, 2006
An atomic operation locks the memory in question and prevents other threads from accessing it during the operation. How granular is the lock? If I have the operation
code:
 array(i,j) = array(i,j) + foo
Is the entirety of array locked, or just the (i,j) cell?

1337JiveTurkey
Feb 17, 2005

Grundulum posted:

An atomic operation locks the memory in question and prevents other threads from accessing it during the operation. How granular is the lock? If I have the operation
code:
 array(i,j) = array(i,j) + foo
Is the entirety of array locked, or just the (i,j) cell?

Atomic operations normally operate on individual word-sized memory locations, so it would just be the cell, not the entire array. If you have a pointer or reference to the array, then there are atomic operations that can operate on the reference itself.

Also nothing is locked, atomic operations just fuse several operations into one. The operation you're using as an example is always atomic because there's no way to see it partially completed, but a more common example is increment-and-get. That's the equivalent of foo = bar++ as a single operation. Nothing can happen between the increment and the assignment in that case.

Compare-and-set is the equivalent of
code:
if (foo == expectedValue) {
    foo = updatedValue;
    return true;
} else {
    return false;
}
Again, nothing can happen between the comparison and the assignment. This can be used for pointers as well as other numbers, so you could get the array reference, if it's null then create the array, and then use the atomic compare-and-set to set it if it's still null. If it is you're done, if not you clean up the array you created and just get the array since someone else set it while we were trying to set it ourselves.

Grundulum
Feb 28, 2006
Thanks for the fast reply. Clearly there are subtleties I don't get about atomic operations. Almost every single tutorial or explanation I've ever seen of atomic operations used that exact example (foo = foo + bar), claiming that it was in fact "read-add-write" as three separate instructions that had to be executed uninterrupted. (The lone exception is some blog post somewhere where I learned that setting unsigned 64-bit integers takes two separate instructions.)

hooah
Feb 6, 2006
WTF?
The idea is that you want foo = foo + bar to be atomic, not that it is inherently. Without the atomicity of that operation, then yes, it's a separate read, add, then write.

Grundulum
Feb 28, 2006
Oh. I got confused at the part where 1337JiveTurkey said "[foo = foo + bar] is always atomic because there's no way to see it partially completed".

Edit 2: Derp. By "is always atomic" he meant "must always be atomic to forestall race conditions", not "is always inherently atomic". Is that right?


Edit: the original reply does answer the most pressing question I had about atomics, so I have that settled at least (if I have <60 threads operating at essentially random locations on an array with >1 000 000 locations, I rarely have to worry about efficiency losses due to the atomic nature of the operation). At this point I'm just trying to learn.

Grundulum fucked around with this message at 18:02 on Jun 19, 2015

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
The number of instructions it takes is not important (*). x86 has an increment instruction, but it is not atomic by default, which means it can be implemented by the processor as separate operations despite its encoding as a single instruction. That makes it much cheaper to execute, but it does mean it doesn't provide any atomicity guarantees.

It is extremely important that you not try to understand atomics as a form of locking. Atomic operations are not locked. They do not respect any other form of locking you are doing. If one thread grabs a lock and then does non-atomic operations on a variable, and another thread just does an atomic operation on the variable, that second thread is fully capable of doing its thing right in the middle of the first thread's critical section and creating all sorts of lovely race conditions.

Also, if you're going to study atomics, you will need to understand memory ordering, which is a very subtle problem with a lot of architecture-specific quirks and pitfalls.

(*) Unless you're only concerned about preemption, but since even phones these days are multi-core, that is no longer a common situation outside of embedded programming. Unfortunately, there's a tendency for older documentation to act as if this is still the case.

Grundulum
Feb 28, 2006
Ugh, I would rather not add a NEW subtle problem with a lot of quirks and pitfalls to what I'm already dealing with. I'm a scientist by trade, and I'm just trying to be a good enough programmer that my eventual grad students look at my code and wince because of the language, not because of the implementation.

So to make sure I'm clear on this, "foo = foo + bar" is sent to the processor as a single instruction, but the processor then splits it into the "read-add-write" triplet. Said triplet is not atomic unless I specifically request it be, which makes sense. I also need to be very careful that other threads aren't trying to do anything non-atomic (e.g. just read? a non-atomic increment?) while my atomic increment is doing its thing, or else the gates of Hell open and the Ancient Ones awaken from their cosmic slumber.

1337JiveTurkey
Feb 17, 2005

Grundulum posted:

Thanks for the fast reply. Clearly there are subtleties I don't get about atomic operations. Almost every single tutorial or explanation I've ever seen of atomic operations used that exact example (foo = foo + bar), claiming that it was in fact "read-add-write" as three separate instructions that had to be executed uninterrupted. (The lone exception is some blog post somewhere where I learned that setting unsigned 64-bit integers takes two separate instructions.)

That's because atomic operations are actually distinct from the separate operations and tie very deeply into the underlying processor implementation. The operations that you see are the ones that are both feasible to implement efficiently and can be used to build higher level concurrency tools. So test-and-set isn't a read, a compare, a jump and a write wrapped in a lock, it's an actual processor instruction like CMPXCHG that's used to make locks in the first place.

My recommendation is if you're starting to learn about concurrency, don't focus on the low level stuff. It can help you understand what weird stuff's possible if you don't synchronize properly but it's better to just synchronize properly. I think it's much more useful to focus on understanding your program in terms of partial orderings rather than total orderings. Total ordering is what you're used to where it's possible to look at any two steps in your executing program and say "step 1 happens before step 2" or "step 2 happens before step 1". With concurrency it's possible that neither "step 1 happens before step 2" and "step 2 happens before step 1" is true.

Some things need to happen in a certain order in your program, others don't. The ones that don't are the places where you can actually use concurrency but knowing all the synchronization tools in the world won't help you if you can't find places to use them effectively. Instead of thinking of your program as a list of steps one after the other, try to see it like a tree or a directed acyclic graph (DAG).

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

Grundulum posted:

So to make sure I'm clear on this, "foo = foo + bar" is sent to the processor as a single instruction,
Maybe. Assuming you're using a compiled language to simplify some things, this still depends on what foo and bar are and what processor you're running it on.

Grundulum posted:

but the processor then splits it into the "read-add-write" triplet.

Again, maybe, depending on on what foo and bar are and what processor you're running on.


I'll give you some examples. Look at the following snippet of C:

C code:
int foo = 12;
int bar = 4;

/* ... */

foo = foo + bar;
It may well be the case that 'foo' and 'bar' live in registers all the time, and the addition itself might get compiled to something like

code:
add $t3, $t4
But it might be the case that one of those values doesn't stay in a register the whole time, so on some architectures you're going to get a load then the add or a load then the add then a store (depending on whether foo or bar or both aren't resident in registers).

On some architectures (like x86), the add instruction may not require that both of its operands be registers. In this case, you'll have one add instruction that will get broken up into micro-operations. So at the end of the day in the case where you make no particular request for atomicity you may get one instruction and a guarantee of atomicity, one instruction without a guarantee of atomicity, or multiple instructions without a guarantee of atomicity.

There are other conflating factors too for a very simple example like the one I used (certain compiler optimizations can eliminate the add itself depending on how foo and bar are used elsewhere, etc.) there which you can safely ignore for the purposes of this discussion

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
1337JiveTurkey is saying something subtle, I think.

In preemptive multithreading, the current thread can get interrupted at an arbitrary point, but it will always be at a complete instruction boundary. (On modern, pipelined / out-of-order processors, this means that before dispatching the interrupt, the processor has to pick some in-flight instruction, then wait for everything before it to retire while discarding the effects of it and everything after.) So if the only modifications to memory are coming from a bunch of preemptively-scheduled threads, you get atomicity just from something being performed as a single instruction, because the preemption will fall either before the instruction or after it. For this reason, you can imagine preemptive multitasking as the processor just executing the instruction streams verbatim in multiple threads and then switching between them at random points.

For example, suppose I just want to increment a counter, x++. If the compiler does this with a single instruction, then it's atomic for the purposes of preemptive multithreading (but compilers don't promise to do this if you're not using atomics!). But if I want to increment the counter and read its current value after increment, the compiler probably won't emit that as a single instruction, so there's a danger that some other thread might get switched in in the middle of my operation. (The actual effect really depends on the instruction set and what the compiler does. x86's in-memory INC instruction doesn't leave the value in a register. If the compiler gets the value after increment by doing a second load, then the switch might happen in between and so the second load might see the results of intervening modifications. But if the compiler gets the value by splitting the increment up into a load, an in-register increment, and then a store, then there might be a switch anywhere in there, which means the store will possibly overwrite some intervening modifications, and multiple threads could see the same value after increment.)

But that's all specific to preemptive multithreading. In true concurrency, most of that goes out the window, because processors will implement instructions as multiple operations and reorder them internally and other cores might be doing the same thing at the same time.

Now, there is a very limited thing that is still true. On every processor I know of, the result of a single, aligned non-atomic store instruction will always be visible "atomically", in the sense that other threads will either see the value before the store or the value after it and not some partially-complete result. So if you only have a single thread writing to memory, you get some of the same simplifying effects as preemptive multithreading and everything is fine. But this only applies to the variable itself, and if, say, the variable holds a pointer, it is extremely architecture-specific whether a thread that reads a particular pointer out and then reads from it will be guaranteed to see stores that were made into that pointer before it was written to the variable. This is the problem of memory ordering, and it can be very, very non-intuitive.

rjmccall fucked around with this message at 19:06 on Jun 19, 2015

1337JiveTurkey
Feb 17, 2005

Grundulum posted:

Oh. I got confused at the part where 1337JiveTurkey said "[foo = foo + bar] is always atomic because there's no way to see it partially completed".

Edit 2: Derp. By "is always atomic" he meant "must always be atomic to forestall race conditions", not "is always inherently atomic". Is that right?


Edit: the original reply does answer the most pressing question I had about atomics, so I have that settled at least (if I have <60 threads operating at essentially random locations on an array with >1 000 000 locations, I rarely have to worry about efficiency losses due to the atomic nature of the operation). At this point I'm just trying to learn.

Sorry. That was actually just me being really dumb there. I was thinking of foo as a local variable which can't be accessed by other processes (like if it's in a register) and bar being the shared value with just a single read. :downs:

edit: Also a reason to stick with the high level stuff is the low level stuff turns people's brains into pudding, like mine.

1337JiveTurkey fucked around with this message at 19:25 on Jun 19, 2015

Grundulum
Feb 28, 2006

Blotto Skorzany posted:

Maybe. Assuming you're using a compiled language to simplify some things, this still depends on what foo and bar are and what processor you're running it on.

Again, maybe, depending on on what foo and bar are and what processor you're running on.

Too much subtlety! Too much subtlety!


Seriously, though, thanks for the discussion you all are having. It's above my level of expertise, but I'm right in that happy Dunning-Kruger middle zone where I think I understand.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip
Sorry that I only really gave one example directly and just spitballed the other cases; some time I'll get around to rigging something up to show the generated asm for snippets for a couple of targets more easily, because it's the most direct way to clarify a lot of things.

hayden.
Sep 11, 2007

here's a goat on a pig or something
.

hayden. fucked around with this message at 23:56 on Jun 27, 2015

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I'm interested in learning about neural networks. Particularly this new fangled deep learning poo poo.

1. My math is weak as I haven't hardly used anything past high school algebra in 20 years, so I assume I'll need to learn some maths of some sort first...what kind if so?

2. What should I read about neural networks? Preferably something based in python because that's my favorite language to learn new stuff in, but I guess I can muddle through with whatever.

Linear Zoetrope
Nov 28, 2011

A hero must cook

Thermopyle posted:

I'm interested in learning about neural networks. Particularly this new fangled deep learning poo poo.

1. My math is weak as I haven't hardly used anything past high school algebra in 20 years, so I assume I'll need to learn some maths of some sort first...what kind if so?

2. What should I read about neural networks? Preferably something based in python because that's my favorite language to learn new stuff in, but I guess I can muddle through with whatever.

1. Basic derivatives and gradients (multivariate derivatives) is all you really need. Neural nets, like most forms of regression/classification, are extremely fancy ways of finding the local minima of some function. Some of the derivatives can be really, really gnarly, but unless you plan on doing original research you probably don't need to actually know how to take derivatives of functions with iverson brackets or whatever.
2. I'd recommend actually starting with Andrew Ng's Machine Learning course for a foundation (which partially covers Neural Nets), then maybe looking at the dedicated Neural Net course by U Toronto on Coursera.

Linear Zoetrope fucked around with this message at 00:22 on Jun 21, 2015

Nippashish
Nov 2, 2005

Let me see you dance!
I second Jsor's suggestion for the coursera courses. Trying to understand neural nets by reading code is a great way to cargo-cult yourself into having no idea what you're doing, although the tools are probably good enough now that you can still make some cool poo poo this way. However,

Thermopyle posted:

2. What should I read about neural networks? Preferably something based in python because that's my favorite language to learn new stuff in, but I guess I can muddle through with whatever.

You're in luck, because python is a very popular language for people working on neural nets. The UMontreal group is pretty strongly committed to python, so it sees a lot of deep learning activity. Some popular modern libraries are
The first four of these are fairly new and incorporate many of the latest and greatest ideas about how a neural network library should be structured. Pylearn2 is much more mature and stable, but can be kind of a bear to work with.

All of these libraries are built on theano (https://github.com/Theano/Theano) which is a mathematical expression compiler that handles a lot of the heavy lifting behind the scenes. The different libraries have different philosophies on how much of their theano internals they expose, some of them hide it completely and others expect you to speak theano fluently to interact with them. Regardless, if you're doing neural nets in python you will probably need to spend some time understanding theano at some point. Theano is a very powerful tool but it can be very strange to wrap your head around.

There's also pybrain (http://pybrain.org/) which is not theano based, but I really don't know much about it. It's kind of old and I don't think it supports GPUs.

Nippashish fucked around with this message at 01:14 on Jun 21, 2015

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Two excellent answers. Thank you, goons.

Good Will Hrunting
Oct 8, 2012

I changed my mind.
I'm not sorry.
What's the proper way to handle exceptions in this API I'm writing with Dropwizard? I've been throwing appropriate exceptions (and setting the appropriate response) at the service level which is called by the resource level. There's really no reason to bubble them up and then again throw them from the resource level if I'm not doing anything there except passing the payload/headers to a service right?

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer
If I have a weighted, undirected graph and I want to find the shortest path (by sum of weights) between two specific vertexes, Dijkstra's can do that in O(E+V), right? I know the general case (finding shortest paths for all pairs of vertices) is slower, but if I stop the algorithm as soon as I reach my target, each vertex should be explored only once and each edge read only once.

This is for homework, so I just want confirmation I'm not crazy before I go hog wild trying to write a proof.

Storgar
Oct 31, 2011
I installed Visual Studio 2013 Express Community Edition and it looks like they took out the Emacs keyboard scheme... Is there something I can do to get back my emacs keyboard shortcuts with this version of visual studio? Everything I tried on google doesn't work and I hear something about Express editions not being able to use third party extensions... C'mon Microsoft... <:mad:>

nielsm
Jun 1, 2009



There is no "Express Community Edition", either you're on Express or you're on Community.

The Community edition is effectively identical to a Pro edition, only there are some clauses in the license forbidding commercial use. You can use any addins and customizations you want on Community.

sarehu
Apr 20, 2007

(call/cc call/cc)

LeftistMuslimObama posted:

If I have a weighted, undirected graph and I want to find the shortest path (by sum of weights) between two specific vertexes, Dijkstra's can do that in O(E+V), right? I know the general case (finding shortest paths for all pairs of vertices) is slower, but if I stop the algorithm as soon as I reach my target, each vertex should be explored only once and each edge read only once.

At most once. I'm pretty sure Dijkstra's isn't O(E+V) though. Unless this is an unweighted graph.

Adbot
ADBOT LOVES YOU

The MUMPSorceress
Jan 6, 2012


^SHTPSTS

Gary’s Answer

sarehu posted:

At most once. I'm pretty sure Dijkstra's isn't O(E+V) though. Unless this is an unweighted graph.

It's a weighted graph, but I need the distance only between a specific pair of nodes, rather than for all nodes.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply