Algebra and geometry of electrical networks